I wanted to do a quick test to see if I could connect a Bejouled Ruby up to the Raspberry Pi and send a serial string.
First, I had to turn the default serial console on the RPi:
1) Edit /etc/inittab and comment out this line:
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
2) Edit /boot/cmdline.txt and remove the following from the entry:
console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
A quick reboot and now to write a quick python script to receive. First, installed pyserial (sudo apt-get install python-serial), then typed in:
import serial ser = serial.Serial('/dev/ttyAMA0', 115200, timeout=1) while 1: line = ser.readline() if (line != ""): print line ser.close()
and saved it as receive.py
On the Arduino I, I put in a quick sketch like so:
void setup() { Serial.begin(115200); pinMode(9, OUTPUT); } void loop() { digitalWrite(9, HIGH); // set the LED on Serial.println("Hello"); delay(1000); digitalWrite(9, LOW); // set the LED off delay(1000); }
Note, that on the Bejouled Ruby, pin 9 is a LED. That way I have a visual when the string is sent.
I wired the Ruby’s 3.3V pin to the RPi 3.3V pin. Connected GND to GND. Then connected the RPi RX to the Ruby’s TX.
Run the receive.py script and get:
Hello Hello Hello Hello
Sweet!
Also nice to see that the RPi can power a Ruby! (Of course, I’m not using the RF12B module at the moment. That may pull more power than the RPi would like).
Howdy, I got over to your webpage via StumbleUpon. Not something I frequently read through, yet I enjoy your views nevertheless. Thank you very much for developing something worthy of reading through!
Hello Dear, are you actually visiting this website on a regular basis, if so afterward you will
absolutely obtain nice know-how.
fantastic issues altogether, you just won a new reader.
What might you suggest about your submit that you just made some days ago?
Any sure?
Hi blogger, i must say you have hi quality content here.
Your page should go viral. You need initial traffic only.
How to get it? Search for; Mertiso’s tips go viral