Power on a Raspberry Pi with Arduino - arduino

I am working on a project which involves to power on/off a Raspberry Pi with an Arduino. In fact the project contains several sensors like a motion sensor and the Arduino will be supplied with a 10kmA battery.
The motion sensor is connected on the Arduino device.
Once the sensor detects a movement, the Arduino will receive the instruction to deliver the 5V to the Raspberry Pi.
How can I supply the Raspberry Pi with the Arduino? GPIO? USB?
I have already seen solutions to power an Arduino with a Raspberry Pi, but never the opposite.

Powering on is easy: just use a small relay that you control with your Arduino, and which switches the 5v from the battery to the RPi.
Shutting down the Pi should be done in two steps:
Setting a GPIO connection to the GPIO header of the Pi, that "sends" the signal to shut down. The RPi must receive this signal as an interrupt on the GPIO and can execute a shutdown-script
The second step should be to wait until the RPi has completely shut down. Maybe you can observe that with the help of the RPi LEDs or something like that (otherwhise, an unclean solution would be to wait XX seconds). After you know that the Pi is shut down, you can open the 5V relay again.

Related

Raspberry Pi to Arduino GPIO wire length

I want to connect a Raspberry Pi 3 to an Arduino via there IO pins so the Pi can send control commands to the Arduino.
The distance between the two devices is around 10 feet (around 3 meters), is this viable using the IO port or is the gap too long? I haven't been able to find the specific specifications for this when I searched.
Thank you in advance xx
The length of the wires is not an issue, but be careful because the GPIO pins of the Pi are 3.3V and the pins of the Arduino are 5V. So be sure to use a level converter between the Pi and the Arduino or you will probably fry your Raspberry.
If you want to send the commands over Serial you also have to connect the RX of the Pi to the TX of the Arduino and vice versa.

Opening serial monitor changes Arduino pin state

I am programming an Arduino Uno. The board is connected to my PC via USB cable. I run the following code with pin 8 wired to an external LED. The program boots and the LED turns on.
Code
If I open the serial monitor in the Arduino IDE, the LED turns off for ~2 seconds and then turns on again.
Why would opening the serial monitor affect the state of the pins on the Arduino? Is the chip faulty or am I missing something obvious?
By default, arduino boards will reset whenever a serial connection is established with them. So when the IDE is started, a new serial conection is established, which restarts the program, causing ~2 seconds of 'down time'. It is possible to disable this setting https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

Interrupt based communication between arduino and raspberry pi

I have 6 Arduinos and 1 raspberry pi B+.
I need Arduino to communicate with pi based on interrupts. For example, if 1 Arduino has to communicate with pi, it sends interrupt and then pi asks the Arduino to send data. On the other hand, Pi can communicate directly without any interrupt.
You can configure the Raspberry GPIO pins as Rising/Falling edge interrupts.
Raspberry GPIO
Then you can use one of the digital ports in your Arduino to generate Rising or Falling edge so it will trigger the Raspberry interrupt.
If you have several Arduinos and you don't want to waste several Raspberry pins, you can connect all Arduinos to a single GPIO pin of the Raspberry (using pullup resistors so when one Arduino Triggers you will not create a short circuit).
You will then need some kind of protocol for the Raspberry to know which Arduino triggered the Interrupt.
Hope this helps

Arduino 433Mhz Receiver USB - Low Range Only on Raspberry Pi

I have an Arduino with a 433mhz receiver attached. I've connected this to my computer via a usb to serial cable.
Connected to my laptop (development machine) it works fine with it (>15 metres), but when connecting it to the Raspberry pi (deployment machine) via the same USB cable the range is REALLY poor (<1 metre).
I've tried using another laptop and again it works fine. Suggesting something is wrong/different going on with the Raspberry Pi.
I measured the voltage at the 433mhz receiver and it was slightly lower when it was connected to the raspberry pi. I tried to rule this add by adding a voltage booster circuit but it made it worst if anything.
laptop = 4.88v
raspberry pi = 4.3v
raspberry pi using booster circuit = 4.98v
I've not tried an external power supply yet.
Any thoughts on what might be causing the problem?
Thank you in advance!
I connected up an external power supply to the receiver instead of using the power coming from the Raspberry Pi / Arduino. This made an amazing difference to the range.
For the receiver module I was working with 5.5V - 6V seemed to give the best range. Anything below 5V was pathetic.

Program an Arduino from a Raspberry Pi using UART

I am trying to program an Arduino mounted on a breadboard using a Raspberry Pi.
For the setup of the Arduino I have been following this tutorial, except from the USB-serial device. Instead I have the Raspberry Pi connected through a level converter. I designed the level converter myself using a 4066 analog switch and an op-amp as a voltage follower to supply a stable 3.3V voltage. The 3.3V from the Pi is converted to 5V on the Arduino pins, and vice versa. I am not getting any response from running avrdude in the shell or through the Arduino IDE on the Pi.
Both the Pi and the Arduino are driving their TX pins to high value (3.3V and 5V). The Arduino has been flashed with a bootloader in a stk500 development board. The command I have been running is:
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega8 -carduino -P/dev/ttyAMA0 -b9600 -D -Uflash:w:/tmp/build4533291593992176675.tmp/sketch_mar21a.cpp.hex:i
LED connected to pin13 flashed aproximately every 6 seconds.
Can anyone tell me how I can get the Raspberry Pi talking to the Arduino?
Fairly stumped. First thing I'd try is just to check that RX/TX communication is working. Write a simple program to read and write on arduino pins 2 and 3 and something similar on the PI.
Other things to look at http://arduino.cc/en/Main/StandaloneAssembly. You might be able to do things using AVR see http://arduino.cc/en/Hacking/Programmer.
There is a new arduino stack exchange https://arduino.stackexchange.com/ it might be worth asking there.

Resources