Arduino and Raspberry Together


Here it is:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"

exit 0
cd /tmp/
/etc/init.d/iptables stop

/home/pi/Downloads/ || exit 1 #added by me
exit 0


Have you tried something like this:

/home/pi/Downloads/ & || exit 1 #added by me
exit 0


The last two days I read a lot from the stack…tried even in the crontab. Nothing works. I am using the new version OS PIXEL.

Tonight I will try also another modifications and give more information.

Thank you for the support!


When i connect something to the digital pin, I have the following code that indicate unsuccessful connection. Any ideas?

Warning: Server connection may be insecure!
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <->,nodelay
2017/03/26 23:31:08 socat[11478] N opening character device "/dev/ttyACM0" for reading and writing
2017/03/26 23:31:08 socat[11478] N opening connection to AF=2
2017/03/26 23:31:09 socat[11478] N successfully connected from local address AF=2
2017/03/26 23:31:09 socat[11478] N starting data transfer loop with FDs [5,5] and [6,6]
2017/03/26 23:31:09 socat[11478] N socket 2 (fd 6) is at EOF
2017/03/26 23:31:09 socat[11478] N exiting with status 0
Reconnecting in 3s...


Just want to make sure I understand – the Arduino connects OK via serial USB connection when there is nothing plugged into it? But as soon as you add something to a digital pin the connection fails? Or do you mean you are connecting something to one of the Pi’s digital pins?

If you mean the Arduino, I wonder if it could be a power issue? Is it running on USB power from the Pi? Do you have an AC adapter so you can ensure the Arduino is getting consistent power?


Hello @rsiegel, I was making tests the whole night (until 4 pm) and I forgot to update my post. It is indeed power issue. I power the arduino through raspberry, and I use special SHIELD of Arduino, which is written that need external power supply. I was forgotten this small note and bang my head the whole night. When I connect 12V 2A to the arduino, everything worked fine :slight_smile:
Thank you :slight_smile:


Hello @rsiegel, I found that it is not a power issue, but something strange with the shield I use for arduino - Open Garden:

None of the Digital Pins works. When I put serial monitor, the first 1-2 second I have values from flow meter and then only zeros.
I write to the support of shield provider. My question is - is there something in the library of Cayenne that might interrupt using this shield? When I remove the shield and connect something to the digital pins - it works fine. Also the shield is working as I can recieve some info from remote node, also I can connect sensors and etc :slight_smile:


I’m not sure. I imagine the shield provider will point you back to us if it works without our sketch file, but then it doesn’t when we’re running. What sort of Arduino do you have it connected to?


I am using arduino uno. I will test a sketch without your libraries tonight.


Hello @rsiegel this is the official answer by their support:

Hello ochikov,

Open Garden doesn’t include any flow meter sensor, and uses every pin in Arduino Uno so there are no free pins to connect any other sensor like a flow meter.


Rather than that, on the picture they listed the Digital/Analog pins and also I was able to connect Xbee shield, which is quite strange why they answer like this…


Okey, everything is clear now:

the UART pins (D0 and D1) are the only free pins in order to program Arduino, and use XBee or other UART modules as WiFly module.

This is the OpenGarden PinOut, where you can see the function of every pin:

Digital Pins

0: Not used (UART)
1: Not used (UART)
2: RF Transceiver (IRQ)
3: RF Power Strip Data In/Out
4: DHT22 Data In
5: DS18B20 Data In
6: Irrigation 1(PWM)
7: Irrigation 2
8: Vcc Sensors
9: Irrigation 3(PWM)
10:RF Transceiver (SS)
11:RF Transceiver (SDI)
12:RF Transceiver (SDO)
13:RF Transceiver (SCK)

Analog Pins

A0:EC sensor
A1:pH sensor
A2:Soil moisture sensor
A3:LDR sensor


Ah OK, so they’ve already reserved every digital pin on the board? :slight_smile:


Yes, so the board is already thrown out and I am starting to build my own board :wink: I already received the arduino uno wifi (integrated esp8266) so I will try to connect it with Cayenne these days :slight_smile:


I have successfully paired my Raspberry Pi 3 to cayenne using the two command lines offered in step two of the setup. After the pi rebooted, I tried entering the command line ./ and got the response “No such file or directory”. In fact, I cannot find any installed Cayenne files anywhere on my Pi. Please advise.


You can browse up and see the link that you can download the whole library:


Thank you for responding. I had already downloaded the library, but what I found the issue to be was that I needed to be more specific with the cd command in the terminal. The library was tucked away in subfolders within my downloads and until I entered cd Downloads/Cayenne-Arduino-Library-master/extras/scripts I could execute the file. I also needed to change the mode to grant permission to execute by typing in the chmod +x command first. I am hoping to add more arduinos to automate a hydroponics farm we have built in our school building. Thanks again.


I was checking out your code for the DHT integration from your Arduino through your RPi3. Did you have to use two different virtual pins in order to get the temperature AND humidity (V0) and (V1) to show up on the dashboard? I saw that you defined virtualPin V1 at the top, but later referred to V0 in your humidity instructions. Any insight would be helpful…thanks!


Just want to say thank you for sharing your solution about running chmod +x on the script before it can be run on a Mac. I ran into the same thing a few months back and we have a bug open internally to update the comments at the top of the sketch to include this instruction. Hopefully we’ll get it updated soon so other users don’t run into this trouble.


When I implemented this, it takes like 2 days to find this command and run it :slight_smile:


When I tried to reconnect my arduino uno via my rpi3 USB port today, I noticed that the dashboard would recognize it for a moment, and then lose connection. This was the first time I tried connecting while I had sensors and LEDs attached to the arduino’s digital pins (DHT11 and DS18b20). When trying to add custom widgets to read the sensors via virtual pins, I was not able to make a connection. The Pi is connected via Ethernet using a static IP address that I have assigned. The rpi3 is being read as usual by the dashboard. Do you have any insight as to what might be causing the loss of contact between the arduino and cayenne? If there is more info you need on my end I am happy to share it…thanks a bunch!