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
Related
BMP388: what is the maximum of slave addresses in I2C mode
In I2C mode with one master how many BMP388 as slave can be connect to an Arduino UNO?
From the datasheet I understand that there are only 2 adresses possible in I2C mode (0x76 or 0x77) as designated by bit 7 in the device address and configured via the SDO (pin 5) port to ground or plus.
In SPI mode, as I hope to understand well from the datasheet, it's up to 128 BMP388 addresses.
My questions are:
-Am I understanding well that in I2C mode the maximum number of slaves is two?
-Of course I can connect a lot of BMP388's in series to the Arduino, but how can I address them in I2C mode. Or should I use SPI mode?
-Is there any documentation, except the datasheet, that makes this more clear?
-Is there any example Arduino code for the I2C situation?
You understood the i2c addressing correctly. There can only be 2 addresses for
BMP388 controlled by SDO pin in i2c mode.
If you want to use more than 2 BMP388 units with a single microcontroller, go with SPI. You can use as many BMP388 units as you have GPIO pins on microcontroller to control Slave Select pin.
This is the example from Adafruit BMPxxx library.
Here is permalink to the line where you can pass Slave Select (CS) pin of each unit to each unique object.
Later in the code you can use each object of the Adafruit BMPxxx library to get the readings.
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.
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.
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.
I want to start a project using arduino microcontroller board. In this project I will use a Mini Thermal Receipt Printer, barcode scanner and the arduino ethernet shield to transfer data to my pc and from my pc. my question is, what arduino board should I buy for such project? is the arduino uno is enough?
The choice of a right Arduino depends on the sort of peripherals you need for example if your barcode reader is SPI enabled and you can't bit-bang SPI then this counts for Hardware SPI usage and as such will take the SPI pins on the UNO which has support for only 1 SPI hardware connection but if you want more SPI connections go for a MEGA ,similarly UART, two wire etc are communication protocols that may be needed by you based on the chipssets you use in your project, also GPIO's are there which just turn on and off.
I will suggest starting off with an Arduino UNO which DIP ATmega328P and get a spare Bootloader acquipped ATmega328P chip standalone in case as a newbie you magic-smoke the chip on the board.