In this project, we will be making a communication between Arduino and Raspberry Pi which transfer vital information by sending data one bit at a time.
Serial communications are essential for every Micro-controllers to communicate between Micro-controllers and another device. The Micro-controller sends these 1 and 0 (bits) that contain necessary information one by one, or Serially. These bits form together and turn into bytes (composed of 8 bits). For further information, check it out sparkfun binary tutorials.
It’s a fairly easy project and can be used either on its own or part of something bigger (Check it Out >> Integrated Weather Station).
Step 1: List of Material
For this project, we will be using:
- Arduino boards (mine Arduino Uno Rev3)
- Raspberry Pi 2
- USB cable cost :~1.00 USD
Step 2: Hardware Connection
In common, the connections are fairly easy. Just connect Arduino USB Plug to Raspberry PI with USB cable and check the connection between Arduino and Raspberry pi by type "ls /dev/tty*" in Raspberry Pi terminal, the result should be content "/dev/ttyACM0" and you are good to go.
Step 3: Raspberry Pi Programming
Below is the Raspberry Pi Serial Communication code. Upload serial_test.ino code to your Arduino (Mine Arduino Uno Rev3) , Run serial_test.py Python code in Raspberry PI, Connect Arduino to Raspberry Pi through USB cable, and you should have no problems.
Step 4: Enjoy!
After making sure that everything works smoothly, you can take this project into bigger project (Check it Out >> Integrated Weather Station)!
Power through batteries or a plug and you’re good to go!