View Single Post
Old 04-16-2014, 11:51 AM   #27 (permalink)
P-hack
Master EcoModder
 
P-hack's Avatar
 
Join Date: Oct 2012
Location: USA
Posts: 1,408

awesomer - '04 Toyota prius
Thanks: 102
Thanked 252 Times in 204 Posts
I considered duty cycle transmission, it is cool stuff, the only issue is that it is another analog link in the chain. There is a software serial library if you don't want to use rxtx. But it is byte oriented, and instead of the whole reading being converted to digital and back into an analog (and back into a digital) you pass the digital bytes directly, with a much "fancier type of pwm". The software serial can also be used to control a serial LCD on pretty much any pins.

So you can have two pins to talk to one board, two for the other, and 1 tx for a serial lcd (which can be remote from the board), you don't care about rx for the lcd because it isnt returning anything interesting. And the only detail you have to worry about is baud rate for these connections.

here is some stuff on the serial lcd, he is using pin 2 for tx, but any can be used: http://playground.arduino.cc/Learning/SparkFunSerLCD

once set up it is like:
pinMode(txPin, OUTPUT);
LCD.begin(9600);
clearLCD();
lcdPosition(0,0);
LCD.print("Hello world!");

and the other boards communicate similarly

and you can talk to other boards the same way, just have to figure out the protocol (i.e. when you send a certain byte or string, what does the response look like).



Of course I will mention that the discovery board (STM32) has 3 uarts , and uart hardware is nice because it can adjust to slightly different frequencies and uses majority vote on each bit to filter out noise. I don't think software serial does, and ev's can be electrically noisy.

Last edited by P-hack; 04-16-2014 at 12:18 PM..
  Reply With Quote