Posts

Showing posts with the label gpio

Smart plugs (in the UK)

Image
Sounds simple enough..  Get a smart plug in the UK that allows you to do the basic thing of switching something ON / OFF and vice-versa. For once, I had a genuine requirement to do this - ah, ha! what is commonly known in the IT trade as a "business requirement"....that could then be technically fulfilled. My requirement was simple: I have a solar panel setup ( as you may have read about ) and whilst I have an ATS (Automated Transfer Switch) in place, all this does it switch from the DC (battery) power over to the mains (240v) power when the battery power hits a low threshold and does the opposite when the battery hits a high threshold.  This will be great in the summer.  However, as it is kinda winter (okay, November, so close enough) we can have days of greyness and a severe lack of sunlight/daylight...and if the solar panels cannot re-charge the batteries, they are on a constant drain until they get below 12v and they are then defunct.  As a novel idea, I want to ...

Using ROS to control GPIO pins on a Raspberry Pi 3

Image
As the title says, it was time for me to document how to do the "simple" task of using ROS (Robot Operating System) to turn an LED on/off (well, we can do a LOT more than that by using the GPIO pins, but as a baseline, it's a starter). Because I've installed ROS onto the Raspberry Pi itself, I can create ROS nodes directly on the RPi. So let's get on with it and create a simple demo to blink an LED using ROS topics from the RPi. First step, we have to download " wiringPi " $ git clone git://git.drogon.net/wiringPi $ cd wiringPi $ sudo ./build The interesting thing is that everyone decides how they are going to refer to the GPIO pins on the RPi ...I just keep track of the physical pin (as that doesn't change!) And here is the GPIO pin layout in relation to wiringPi: https://projects.drogon.net/raspberry-pi/wiringpi/pins/ Now that we've installed the library we're going to be using, let's switch to creating a ROS package...