USB TTL programming documentations

Related to the development libraries, released by Curt Binder
Post Reply
zsxking
Posts: 9
Joined: Thu Dec 05, 2013 2:10 am

USB TTL programming documentations

Post by zsxking »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: USB TTL programming documentations

Post by lnevo »

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
zsxking
Posts: 9
Joined: Thu Dec 05, 2013 2:10 am

Re: USB TTL programming documentations

Post by zsxking »

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.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: USB TTL programming documentations

Post by binder »

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
zsxking
Posts: 9
Joined: Thu Dec 05, 2013 2:10 am

Re: USB TTL programming documentations

Post by zsxking »

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?
zsxking
Posts: 9
Joined: Thu Dec 05, 2013 2:10 am

Re: USB TTL programming documentations

Post by zsxking »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: USB TTL programming documentations

Post by lnevo »

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.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: USB TTL programming documentations

Post by binder »

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.
Post Reply