abdjeet
Posts: 3
Joined: Sun Apr 02, 2017 11:18 am

Raspberry Pi-Arduino Serial Communication

Thu Apr 13, 2017 10:24 am

Hello.I am working on a project where I have connected pir motion sensor to arduino uno and connected my webcam to raspberry pi.What I want to do is when motion is detected my webcam should be triggered so that it can capture photo and then send it through email.I am little bit aware that this can be achieved using serial communication but still I need help.

PiGraham
Posts: 3935
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspberry Pi-Arduino Serial Communication

Thu Apr 13, 2017 10:39 am

abdjeet wrote:Hello.I am working on a project where I have connected pir motion sensor to arduino uno and connected my webcam to raspberry pi.What I want to do is when motion is detected my webcam should be triggered so that it can capture photo and then send it through email.I am little bit aware that this can be achieved using serial communication but still I need help.
Why not connect the PIR to the Pi GPIO? That's the easiest option.

You can use Arduino and serial communication. Both Pi And Arduino have UART serial, but you should use a voltage level translator to match the Pi 3.3V to Arduino 5V.
On Pi the UART may, by default, be configured as a serial terminal. You would have to disable that in raspi-config. A quick search on raspberry UART should get you there.
Just connect Tx, Rx on the Pi to Rx, Tx on the Arduino, set both devices to same baud rate, data bits, parity and stop bits and use serial in/out function to send and receive messages that you will define. It could be single characters.

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Raspberry Pi-Arduino Serial Communication

Thu Apr 13, 2017 1:23 pm

PiGraham wrote: You can use Arduino and serial communication. Both Pi And Arduino have UART serial, but you should use a voltage level translator to match the Pi 3.3V to Arduino 5V.
On Pi the UART may, by default, be configured as a serial terminal. You would have to disable that in raspi-config. A quick search on raspberry UART should get you there.
Just connect Tx, Rx on the Pi to Rx, Tx on the Arduino, set both devices to same baud rate, data bits, parity and stop bits and use serial in/out function to send and receive messages that you will define. It could be single characters.
or just connect the Arduino Uno by USB cable!!

PiGraham
Posts: 3935
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspberry Pi-Arduino Serial Communication

Thu Apr 13, 2017 1:51 pm

KLL wrote:
PiGraham wrote: or just connect the Arduino Uno by USB cable!!
Of course that works too, if you use an Arduino with USB (e,g, Arduino Pro isn't USB) . The OP asks for serial, not USB. Maybe there is some reason that USB is not ideal. Who knows?

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Raspberry Pi-Arduino Serial Communication

Thu Apr 13, 2017 3:44 pm

Alex Eames has written this great tutorial for connecting his arduino based device to a pi, there is a section on serial communication that should apply to any arduino based controller.
Doug.
Building Management Systems Engineer.

abdjeet
Posts: 3
Joined: Sun Apr 02, 2017 11:18 am

Re: Raspberry Pi-Arduino Serial Communication

Fri Apr 14, 2017 7:40 am

BMS Doug-Thanks for sharing the tutorial.But,I don't want to just display the text.What I want to do is that ,the motion sensor which is connected to arduino, when it detects motion it shoudl trigger the webcam module connected to raspberry pi.Is it possible?

Return to “Beginners”