Arduino and Raspberry Together


#21

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"
fi

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

/home/pi/Downloads/cayenne-ser.sh || exit 1 #added by me
exit 0

#22

Have you tried something like this:

/home/pi/Downloads/cayenne-ser.sh & || exit 1 #added by me
exit 0
???


#23

Yes,
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!


#24

Hello,
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 <-> TCP:arduino.mydevices.com:8442,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 54.174.252.197:8442
2017/03/26 23:31:09 socat[11478] N successfully connected from local address AF=2 192.168.1.105:37544
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...

#25

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?


#26

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:


#27

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:


#28

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?


#29

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


#30

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.

Regards

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…


#31

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
A4:RTC (I2C-SDA)
A5:RTC (I2C-SCK)
Regard


#32

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


#33

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:


#34

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 ./cayenne-ser.sh and got the response “No such file or directory”. In fact, I cannot find any installed Cayenne files anywhere on my Pi. Please advise.


#35

You can browse up and see the link that you can download the whole library: https://s3.amazonaws.com/mydevices-cayenne/arduino/lib/prod/Cayenne.zip


#36

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.


#37

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!


#38

Just want to say thank you for sharing your solution about running chmod +x on the cayenne-ser.sh 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.


#39

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


#40

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!