Thursday, June 14, 2018

No input enabled while your app in docker container on Raspberry Pi

If you happen to go through this issue, the solution is very well explained in this SO answer, and the reason is a Docker container does not, by default, have access to any host devices.

Tuesday, May 29, 2018

Sense HAT & Sense Emulator = a perfect couple

If you're a Raspberry fan, chances are you already know about Sense HAT. It's an add-on board that provides an 8×8 RGB LED matrix, a five-button joystick and sensors: gyroscope, accelerometer, magnetometer, temperature, barometric pressure, humidity. A good thing is a "official" Python library supporting easy access to that hardware.

But a better thing is the Sense Emulator, an interactive application providing an interface for emulating the Sense HAT hardware. The idea is that you can develop a Python application intended to interact with the Sense HAT hardware without worrying about actually having such board at hand.

The way it works is that when working with the emulator within your Python application, you create a main class SenseHat giving accesss to all sensors, the LED pixel display, and the joystick. If you follow the recommendation of importing the library with the following idiom:
from sense_emu import SenseHat
then when you wish to deploy your code on an actual Sense HAT board the only change you need to make is to that line, changing it to:
from sense_hat import SenseHat
Fantastic! One line change it's all you need to move from sotfware emulation to actual hardware. Everything remains the same in your code.

Sunday, March 25, 2018

Regulable power supply

Are you wondering what this post has to do with a Raspberry Pi? I'd say a lot, since one of the magic things of working with a RPi is the ability to connect to thousands of circuits via its GPIO. On doing so, you may need 3.3 volts, or just 5 as a USB cable, why not 12 for DC motors?, etc.

Monday, July 25, 2016

Raspberry Pi as FM transmitter

I cannot believe Raspberry Pi boards are so versatile. Well, that's the point of a general purpose computer after all, isn't it? It looks like guys Oliver Mattos and Oskar Weigl managed to code a pretty good program to transmit on FM (frequency modulation) from the Raspberry PI cards.

Monday, July 4, 2016

Look Ma! no keyboard, no mouse, no display...

While booting a RPi you usually attach a keyboard/mouse and display (i.e. via the HDMI connector). But what if you don't have such peripherals at hand? or you just want to run a "headless" server?

Boot from USB

All Raspberry Pi models (from old A up to 3) are intended to boot from the SD/microSD slot. Period. With microSD cards of 16 GB or 32 GB there should be no space problems for most applications. However, what if you want to use a USB stick or a removable hard disk (imagine 1TB or even 2TB!) as the boot device?.

Tuesday, May 31, 2016

Driving Adafruit motor shield from RPi with Python

As I planned to build a RPi controlled robot, I selected the Adafruit motor shield v1 as the component to control the robot's two DC motors. But given the project I was using as a guideline uses a L293D-based circuit and all the source code is Python, I was facing a problem...