USB TTL programming documentations

Related to the development libraries, released by Curt Binder

Posts: 9
Joined: Thu Dec 05, 2013 2:10 am
PostPosted: Fri Mar 25, 2016 1:37 am
Hi,

Is there any documentation of how to read data via USB TTL cable and write data to it? I want to write a server to use Raspberry Pi to monitor and control reefangel.

Thanks,
User avatar
Posts: 5348
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Fri Mar 25, 2016 9:48 am
It would be the same as the web protocol. You should be able to sens HTTP get's to the serial and you'd receive back the same output you'd get from a web request

Posts: 9
Joined: Thu Dec 05, 2013 2:10 am
PostPosted: Fri Mar 25, 2016 8:17 pm
Have you tried using USB TTL from a linux environment like from Raspberry Pi?

I was trying to use minicom to connect to it, but not seem to be able to communicate. My settings are
| A - Serial Device : /dev/ttyUSB0
| B - Lockfile Location : /var/lock
| C - Callin Program :
| D - Callout Program :
| E - Bps/Par/Bits : 57600 8N1
| F - Hardware Flow Control : No
| G - Software Flow Control : No

But it still Offline.
User avatar
Posts: 2737
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Sat Mar 26, 2016 9:39 am
try 115200 for the baud rate. I believe that is the default for it. (i may be wrong though)
i have a regular linux desktop environment working, so having it work on the pi should be doable.

Sent from my XT1585 using Tapatalk

Posts: 9
Joined: Thu Dec 05, 2013 2:10 am
PostPosted: Tue May 10, 2016 12:41 am
binder wrote:i have a regular linux desktop environment working, so having it work on the pi should be doable.


How do you develop in your linux environment?

Do I just write to the usb serial port like "GET /sa" then read from it? Don't have too much experience working with serial.

Would you mind provide a piece of code sample to read data from USB and print it as string on linux?

Posts: 9
Joined: Thu Dec 05, 2013 2:10 am
PostPosted: Tue May 10, 2016 4:37 am
If I keep listening to the serial port, I can get something like it occasionally:
GET /status/submitp.aspxt1=784&t2=761&t3=0&ph=794&id=zsxking&em=0&em1=0&rem=0&bid=1&key=&ddns=&af=0&sf=0&atohigh=0&atolow=0&r=209&ron=0&roff=255&pwma=0&pwmd=0&pwmao=255&pwmdo=255

But can't figure out how to request data actively.
User avatar
Posts: 5348
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Tue May 10, 2016 7:54 am
yes, that's the head unit sending out http requests to the wifi module.

you should be able to write GET /sa followed by two newlines, same as http protocol.
User avatar
Posts: 2737
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Tue May 10, 2016 6:53 pm
zsxking wrote:How do you develop in your linux environment?
I use CodeBlocks IDE for development of the libraries. I imported all the libraries and created my own workspace inside the app and I edit/write the code that way.
When testing the code on the controller, I just use the Arduino app. I use it to compile and upload the code.

I edit my INO files using the Arduino editor (or an external text editor) and the use it to compile and upload. This is most likely what you will be doing. Unless you are making changes to the libraries, you will just want to use the Arduino editor or whatever your favorite code/text editor.

Do I just write to the usb serial port like "GET /sa" then read from it? Don't have too much experience working with serial.
I just use the serial monitor that's built into the Arduino program. To get the status, yes, you would use "GET /sa ". When you are using the serial port and sending the commands, you MUST include a blank space at the end of the command. That is needed only when manually typing the commands in. If you use a web browser or one of the apps, you don't need that extra space.

Would you mind provide a piece of code sample to read data from USB and print it as string on linux?
See the previous question's reply. I use the Arduino environment so there's nothing extra or special that needs to be done other than using the serial monitor that's included with Arduino.

Return to Development Libraries

Who is online

Users browsing this forum: No registered users and 3 guests

cron