Hot answers tagged

77

Some background The most important thing you should know is that the RaspberryPi is a strange beast where the ARM CPU is the not main CPU - it's only a co-processor to the VideoCore GPU. When the RaspberryPi starts, a GPU blob is read from the SD card to the L2 cache and executed. This code then brings up all the important peripherals (RAM, clocks etc) and ...


12

The answer to your question title has been hard to word better than gregeric explained: dwc_otg is the driver that has been heavily patched to squeeze most performance & function in host mode on the Pi: the fiq stuff etc. So heavily patched that, despite the name, it only does host mode & not OTG. dwc2 is an upstream driver which can do the OTG host/...


11

The short answer to your question, how to safely connect the RPi to an Arduino, is indeed given at the first link you posted: http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/. I have used the method given there with great success, and without damaging any components. But your question suggests that you don't trust that method, and I think the ...


11

I actually fixed this error going step by step, apt seems to have a bug in the way it handles ca-certificates-java and openjdk-8-jre-headless on raspbian. So I did : sudo apt-get remove openjdk-8-jre-headless openjdk-8-jre sudo apt-get install ca-certificates-java sudo apt-get install openjdk-8-jre-headless sudo apt-get install openjdk-8-jre # Optional, ...


10

@LiWi's answer will work temporarily, but the permission change will be lost once the device is removed or the server rebooted. A permanent solution is to add your user to the dialout group, which will allow it to access serial devices. sudo usermod -a -G dialout youruser


9

Look at the lesson Baking Pi – Operating Systems Development. It's an ARM-only lesson, but it uses pieces of C for the USB driver.


9

I²C protocol is very simple. It does not really define data structures that are sent over the wire. The frame consist of a slave address (with direction bit indicating if master wants to read or write) and (in case of writing) some bytes of data. Since it doesn't make sense to initiate write with 0 bytes of data, first byte is mandatory. This first byte is ...


8

There are a few factors to consider here: The power input to your Pi is probably through a wall adapter or PSU. You should check the rating of the adapter/PSU. If it is in the range of 1.5A to 2A, then your problem is partially solved. Next in play, is the polyfuse and regulator on board the Pi. As per specifications on Adafruit, the B+ can handle upto 2A ...


7

To update Krzysztof's great answer, Broadcom finally publicly released some code, licensed as 3-Clause BSD, to aid the making of an open source GPU driver. The "rpi-open-firmware" effort to replace the Raspberry Pi VPU firmware blob started in 2016: https://github.com/christinaa/rpi-open-firmware. See more at https://news.ycombinator.com/item?id=11703842 ...


7

If you don't want to spare your USB port of your Rpi, you can use GPIO Serial to communicate with your Arduino. There is a great tutorial of Conor O'Neill for connecting Rpi with a Arduino Pro Mini. The procedure is the same with your Arduino Uno. All you need is a LLC (Logic Level Converter) to be able to connect these two devices. As you've already ...


7

There is an Open Source project underway at: https://github.com/me-no-dev/RasPiArduino This basically allows one to use the Arduino IDE in conjunction with a cross compiler that generates executable code that will compile arbitrary Arduino sketches and allow them to fully run on the Pi. This project is still in a very early phase but so far I have been ...


7

"Arduino devices" are really just general purpose devices that operate on 5V logic and can be connected to a bus style supported on an Arduino, such as UART, SPI, or I2C, none of which originated with or are unique to it. This means you can use such devices with anything supporting the communication (busing) methodology and a compatible, 5V logic level.1 "...


6

You can connect the Arduino to the Raspberry Pi with an USB cable. That gives you a serial connection. On the Raspberry side, you can use a library like pyserial. On the Arduino side, you can read bytes with char x = Serial.read(); There's a tutorial at https://www.instructables.com/id/Interface-Python-and-Arduino-with-pySerial/


5

Absolute safest would be Bluetooth serial. With a supported USB dongle on the Raspberry Pi and something like a Bluefruit EZ-Link on the Arduino, you could program and control the Arduino from the Raspberry Pi with no physical connection. Next best would likely be through USB. There is a “standard” protocol (Firmata) for interacting with Arduino and sensors,...


5

My opinion is that, yes you should. Especially since you are powering an Arduino and a WiFi dongle. The reason why some often you need a power USB hub is because the RPi itself doesn't have enough juice to power a lot of high amp devices. I have a webcam attached to mine with a Bluetooth dongle and without my hub, the dongle doesn't allow devices to connect ...


5

The link you give is to the soil sensor which is not an Arduino. Did you mean to ask whether you could use the soil sensor with the Pi? Yes you can but to get analogue results you'd need to add an ADC (I2C or SPI based ADCs are commonly available and will work with the Pi.) If you did mean to link to an Arduino then yes you can use an Arduino with the Pi. ...


5

ALL the Pi GPIO are 3V3. NONE of them are tolerant of voltages outside the range 0 to 3.3V. EDITED TO ADD: The only pin which feeds into the Pi will be that connected to MISO (Master In Slave Out). The simplest thing to do is use a voltage divider on that line to cut the ADC 5V output to a Pi safe 3V3. A voltage divider is typically a pair of resistors. ...


5

I'm wondering, may understand that Raspberry Pi's I2C is in fact the SMBus version of I2C ? I don't think it is limited in that sense but that is the normative way to use it. There is no such limitation with the kernel, since the protocol docs for the interface say, "If you write a driver for some I2C device, please try to use the SMBus commands if at all ...


4

Raspberry Pi ARM based bare metal examples is another good reference. First you'll need to learn how the Raspberry Pi operates, how it boots, what's needed to get your code running without an existing operating system and so on - the README gives you a lot of information.


4

Single master (Pi) multiple slaves (Arduinos) communication can easily be done with RS485 and MODBUS. There are many open source MODBUS protocol implementations for both Pi and Arduino. With 115200 bps and 2 slaves for example, you can exchange up to few hundred short messages per second.


4

The Raspberry Pi and all microcontrollers used in the Arduinos natively support a number of standard protocols, e.g. RS-232 (often called "UART" on embedded platforms), SPI and I²C/TWI, for each of which you will find plenty of tutorials. RS-232 is probably the most robust of them when it comes to long transmission distances, but at the 10 to 15 meters you'...


4

If you're looking to do a robot then I'd recommend using something like Nanpy. It essentially requires flashing the Arduino and connecting it to the Pi via USB. It's pretty quick and painless to set-up. You can write your Arduino code in Python and communicate with the GPIO on the Pi within the same script, which can be handy. I've used it on a small robot ...


4

ESCs (Electronic Speed Controllers) are typically controlled just like you would control a hobby servo -- with a PWM signal. There are many guides to controlling a servo that should be applicable to the ESC. Since the Raspberry Pi is a 3.3V device you might need a level shifter if your ESC needs a 5V signal. Here is a tutorial for Raspberry Pi: https://...


4

If you need low latency communication, know that interpreted code is always going to be relatively slow. Code compiled into CPU-native instructions, as C and C++ almost always are, will run much faster, 50:1 or more in some cases. For extreme cases, once your application works, re-visit the critical code and see if it can be improved by hand-writing it, or a ...


4

I finally figured it out. What happened was that when I first got the modules I accidentally hooked them both up to a 5V rail instead of the recommended 3.3V, or at least this is my best guess as to why nothing was working. I got another pair of the RF modules today and made sure to only connect them to 3.3V and they work absolutely perfectly with all of the ...


4

I'd go so far to say that the computational power of an arduino would be quite a limit to voice recognition. Bitvoicer for example uses the arduino to sample the speech but not to process and recognice it. It sends the stream to a more powerful system to do the recognition part. The Pi on the other hand is powerful enough to do all the processing itself as ...


4

You may be finding the UART(or USART) communication, which is what Arduino RT/TX pins and some of RPi GPIO pins used for. USB ports uses 5V and UART pins are for 3.3V, thus you may need additional 5V-3.3V interconvert circuit to use as your first describe. If you choose to use direct UART communication instead, you don't need such additional circuit. I've ...


4

If you want the Pi to be able to tell you (via email notification or whatever) that it was not shut down properly the last time it was active, a simple solution is to arrange for a simple script that (a) runs at startup and creates a flag file and (b) runs at shutdown and deletes the flag file. At startup, you check if the flag file exists before you create ...


4

You need to do a few things before being able to use /dev/ttyAMA0 Add your user (that will use ttyAMA0) to the dialout group: sudo usermod -a -G dialout pi (pi is the user here) Disable linux using the serial port as a terminal: sudo raspi-config Select Interfacing Options Select Serial "Would you like a login shell to be accessible over serial?" ...


4

I see two ways of doing this: 1. UUID Based You could write a very simple script, possibly in Python, to check for a specific UUID to be plugged into the Pi. The script would then shutdown the Pi. It would go something like this: import os import time while True: if "123456789-1234-1234-1234-1234567890" in os.popen("ls /dev/disk/by-uuid/").read(): ...


Only top voted, non community-wiki answers of a minimum length are eligible