ATX-Raspi: smart power controller for RaspberryPi

UPDATE: please see this page for the latest revision details.

I’ve posted details about one of my last projects that I’ve been working on.

ATXRaspi is a smart power controller for RaspberryPi or similar embedded systems running form a 5V input. It allows you to have an external shutdown button to turn off your target system without a need to login or to issue manual shutdown/sudo halt commands. I needed this so I could power off my Pi without having to log in all the time. I wanted a physical button to shutdown/turn off my RaspberryPi.

Also now available in the shop, pre-assembled or as a DIY kit.

DSC02674_ATXRaspiATXRaspi_wiring_to_RaspberryPi

Moteino wireless programming source code

I managed to put together a library and refactor the code that I used to achieve Moteino wireless programming.

There’s a new WirelessHEX file in the SPIFlash library. There are new WirelessHEX classes for RFM12B and RFM69W/HW transceivers. These files contain helper code that handles the new sketch over-the-air transmission for both the transmitting and receiving ends. It will increase your sketch size by a few KB, that is just an unavoidable tradeoff.

The target node that is to be wirelessly reprogrammed will need to have code to listen for a potential new sketch. I uploaded the example sketch along with everything else to the RFM12B library examples.

The gateway node sketch, target node sketch, python script that passes the HEX file to gateway node are all located here: 

https://github.com/LowPowerLab/WirelessProgramming

The custom DualOptiboot bootloader allowing the reflashing with the sketch stored on the external SPI FLASH memory chip is here: https://github.com/LowPowerLab/DualOptiboot
I managed to keep the size just under 1k. So in the future Moteinos will probably ship All Moteinos (R2 and R3) are now shipping with this bootloader to allow for potential wireless reprogramming if you also have the FLASH chip onboard the target mote.

I would call this an alpha release even though it works pretty well. Sometimes it’s a hit or miss because of the delays I’ve set in python. Those could be refactored and code improved to be smarter about initial requests for a sketch transmission. But it seems in most cases it works the first try.

Further improvements are:

  • increase speed of transmission
  • test with larger sketches
  • refactor python script, WirelessHEX library and gateway/target node sketches

I’ll try to keep up with changes and updates. Right now I have no idea if anyone will find this useful or not.

Raspberry Pi websockets with Python & Tornado

I started to look into websockets for RaspberryPi. My Pi is overclocked at 900Mhz and it’s stable but even so it became apparent that loading it with too many HTTP requests for various things (streaming data into EmonCMS works over HTTP) can get slow. So here’s a simple working Hello-World websockets example in Python, using the popular Tornado websocket library. It’s a very simple echo program, but I think proves the point that websockets are much faster than HTTP requests since they are a direct link between the server and the browser.

RaspberryPi_websockets_example_python_tornado Continue reading