RGBtree Working on an Ardunio – Yay

img_2610Having got the Pi variant of Andrew Gale’s RGBtree working nicely I thought I would use some spare time over the last couple of days to setup the alternative Micro:bit/codebug  version on a Arduino Uno clone, for a bit of fun. Cobbling various bits of Ardunio code together I now have an RGBtree that can will play one of  5 different Christmas songs, when the switch is activated – while running through a random series of colour changes in time with the music. Once the tune has finished playing the Neopixels will continue to change randomly. You can download the code from my Github here. I have also uploaded a quick video to YouTube if you want to see and hear it in action !   .

The music uses quite a lot of the Arduino’s ‘variable’ resources, so Iimg_2610 have kept the Neopixel effects simple here. I did not have to make any changes to the RGBtree to get it working with the Arduino, but do be careful if you change from the default brightness settings as the Neopixels can get very bright. The RGB tree is supported on two pins that I was able to position spaced correctly to pickup 5V and GND on the Arduino board. [The Neopixels seem fine working at 5V rather than the labeled 3V.]

I think it is relatively obvious from the code if you want to adapt the code to play different tunes – the size and number of tunes is limited by the ‘variable’ memory size of the Arduino. I guess you could change it to store the tune data in program memory which would greatly extend the storage as an option.

Posted in Uncategorized | Leave a comment

An RGB Tree Happy Christmas

img_2581A big thanks to Andrew Gale for getting a missing RGB  tree to me in time for Christmas. To celebrate (and avoid the wrapping),  I’ve cobbled together a quick Python App that gently runs through the spectrum on each of the LEDs in a random order. You can down load it from my git hub here (The colours look a lot better in real life).

Now the next question do I get on with wrapping or see if I can get it working with an Arduino …..


Posted in Uncategorized | Tagged , , | Leave a comment

Mk2 Low Cost Home Automation

time2A While ago I setup a Pi to control some quite cheap 433Mhz RC mains switches I got from Maplin [ code N78KA]. The controllers were connected to Lamps to automatically light up various rooms in the house after dark.

The RC switch comes with a simple 4 way hand controller and initially I was just planning to hack this. However looking on the internet I found a few examples where people had used Arduino’s and Pi’s with cheap RC transmitters to ‘mimic’ the signals rc-switchgenerated by the hand controllers, to operate the remote units. I could not find any examples of people who had used the exact Maplin RC switches I had, but reading around it looked like the rc-txcodes were relatively common between products. After a very frustrating day of trial and error I decided to apply a bit intelligence and got the oscilloscope out and started comparing the serial data coming from the Pi and that produced by the hand controller. Quite quickly I realised that the data from the Pi was correct but back to front, having correcting this I was able to activate the remote switches at will !

From here I wrote some simple Python code to control light positioned around the house, planning to tidy it up. Well that was over a year ago ……

The main drive to produce a mk2 version was to avoid me having to manually alter the timings as the length the day changed. It had always been a plan to sort this out with a light dependent resistor (LDR) but I just never got around to it.

Having decided that I could not face another autumn with the family moaning about the house being dark I decided now was a time to get this updated. In addition to auto correcting for the daylight I also wanted to improve the status feedback. The mk1 version simply had a single LED which flashed every few seconds to show the Python code was still running.
img_2439For the display I landed on a miniature OLED display I had picked up from a JAM earlier in the year. You can see the details for this on my last blog posting. As part of the ‘upgrade’ I decided to start from a clean installation of the latest Rasbian . This necessitated trying to re-learn how to get the RC serial libraries working again as I had not written it down the first time around [there is a lesson here], somehow in this process I ended up with different library [https://github.com/lexruee/pi-switch-python] which turned out to be a whole lot easier to work with than the one I used first time around.

The next thing to sort out was adjusting for the changing daylight hours. Using an LDR to detect darkness was fine until my daughter left the light on in the room where the Pi was….. I wanted a self-contained control unit so running wires from a remotely mounted LDR attached to a window was not any option. The solution I landed was to use sun rise and set times, initially I looked at getting these from the web, but that assumes a good long terms stable wifi link, which is a little unrealistic in my experience. After a bit of searching I found an quite old [2004] bit of s/w called sunwait. I think it was originally developed to be used with cron, but can be run from the command line to give sun rise / set times for any given latitude and longitude. The the output is a fixed format so it is possible to reliably grab the target information without too much difficulty. I have written a page in the ‘random Pi notes’ section of my site which describes how to install and basic usage of sunwait.

rc-testHaving tested the individual bits of code I pulled them all together. The resulting application and a number of the test programmed I used to figure out how bits worked can be found on my git-hub. I have tried to comment the code so it is understandable – not least as I struggle to otherwise. Currently the code allows for each controller channel to define an on time relative to sun-set, an off time and a random element. The timings are adjusted daily, in-line with changes to sun rise and set times. In addition, when the code is first run it does a basic check to see if it has missed any comments so it will recover straight away from power cuts which are quite comment where we live. The code is still a little work in progress although stable it needs a tidy up and a cleaner way to setup the timings.time1

Hardware wise I have manged to get everything into an old Pimoroni Pibow case. Pi wise it
is running on an early [no mounting holes] Pi B. I find applications like this a great way to use older hardware which is bit slow to experiment with but still more than fast enough for an application like this. It also helps to keep the costs down as I had all the bits already.

Links to Instructions / help

Setting up an OLED

Install instructions for sunwait

Setting up the RC433 switch library

Link to my Git-Hub  – you can find my controller Python code here

Maplin RC controller product codes – N78KA  [ 1 off] N38HN [ 5 off]

Posted in Uncategorized | Tagged , , | Leave a comment

Tiny OLED displays

img_2439At the recent CAMJAM I got lots of questions about a small OLED display I was using as part of a home lighting control project.

If you are looking to include a small inexpensive status display on your next project, one of these may be just what you need. Prices range from around £16 from the UK Adafruit distributors to £6 on a UK Ebay site – if you are happy to take a bit of chance you can find them even cheaper from sites in the Far East.  img_2435

The picture to the right gives you an idea of how much you can display – this is a single colour 132 * 64 pixels module. The great thing about these displays is being OLED, they don’t have a backlight avoiding the separate drive circuit often needed for ‘traditional’ LCDs.

The modules generally seem to come  with either and I2C or SPI interface.  I have only used I2C varients but the driver software from Adafruit can be configured for either type.

It is worth highlighting that all the small displays of this type that I have seen run on 3.3V not 5V – I have not had any problems running them directly from the Pi 3.3v supply.

Configuring a Pi to drive them was quick and simple – follow this link to see some detailed instructions that work for me.

Posted in Uncategorized | Tagged , , | Leave a comment

Tempus Fugit WordClock Section Goes Live

IMG_2096With the first TF WordClock kits shipping yesterday the TF area on the blog is now  fully live. In addition to information about the TF there is a new instruction page where you can find links to the instruction / operation manual and github for software downloads. I am happy that the cloIMG_2102ning process for SD cards is good so will be working on these from tomorrow. Just under half the early bird kits have now been shipped covering destinations from Australia to Swindon the rest should all go out over the next few days.

Posted in Uncategorized | Tagged , , | Leave a comment

Happy Arduino Day 2016

ard_day2016Happy Ardunio Day 2016 from the Meandering IMG_1868Pi.
We will be at the Peterborough Raspberry Jam on the 9th of April  showing off the latest work on the Tempus Fugit WordClock in both Pi Zero and Arduino Nano Versions, together with other Pi projects old and new.



Posted in Uncategorized | Tagged , , , , | Leave a comment

WordClock Prototype PCB Tested

IMG_1814The prototype Tempus Fugit PCB arrived as promised last week from Ragworm, leaving me just enough time to get it built up our Show & Tell at the Pi Party on Sunday. We had lots of positive feedback particularly with demonstrating the ability to swop from a PiZero to a Arduino Nano without having to make any changes to board. With 13 days to go on the Kickstarter we are just £250 short of the stretch target – adding automatic brightness control to the design.bigb

I really enjoyed the Pi Party meeting people new and old. A particular shout out to the Marshal who helped get omxplayer to loop for me and putting my wife in-touch with with someone to talk about Bluetooth.

Posted in Uncategorized | Leave a comment

Tempus Fugit WordClock Kickstarter for your Pi or Arduino

IMG_1764aAs trailed in an earlier blog posting I have spent a bit of time over the last couple of weeks working up my Word Clock to run as a Kickstarter. The result is the Tempus Fugit WordClock. you can see in the picture  what the PCB will look like, I will update this with an actual photo in  a couple of weeks when I have got a prototype PCB build. pcb rev4The big development as you might have guessed from the blog title is that the Tempus Fugit will work with an Arduino Nano as an alternative to a Pi Zero so hopefully will still be attractive to people struggling to get hold of the Zero.

Check out the Kickstarter by clicking here.


Posted in Uncategorized | Tagged , , , , , , | Leave a comment

BBC Micro:Bit Hands-On

microbitWe Attended a great STEM BBC Micro:bit networking event earlier this week at Reading University, I had seen the Micro:bit at BETT but had not been able to get ‘hands-on’. The first thing to be clear is that while there is some level of overlap between the Raspberry Pi and Micro:bit they are different, both have good and bad points when you consider their target markets. Having not looked too closely at the Micro:bit before I was pleasantly surprised with the in built hardware which includes accelerometer, compass, I2C and Bluetooth, see the following link to the dedicated BBC media site to see a more complete spec. On the down side the only direct ‘display’ capability is a 5 x 5 matrix of LED.FullSizeRender1

Programming is via a browser web interface (Explorer and Chrome both seemed to work), connected via a micro USB ( I am assuming you will also be able to connect via Bluetooth in the future but this was not demo’ed at our session ). One of the key design elements is that nothing ‘special’ should need to be installed on the PC / Tablet / Smartphone to control / program the Micro:bit. A number of programming options will be available, we used the Microsoft “Block Editor” which is very Scratch like in terms of operation. Having tested your program (which you do within the programming environment), hit the compile icon and the an executable is created on a remote server application and automatically downloaded to via the your browser. You then drag this file onto the Micro:bit (which appears as a mass storage device / drive on your PC) and it is again automatically downloaded to the Micro:bit and the application runs. An option to program in Python is also shown on the website, this is not available yet but my wife did a bit of digging and found this  article  which gives a lot more info. As I understand it the only potential option for local programming on the Micro:bit will be Python, other options all seem to need good web access.

In terms of interfacing to the outside world it has 3 digital / analogue  input / outputs which come out as ‘rings’ you can connect to with small crocodile clips, there are additional functions including I2C available via the edge connector, but it is worth noting that other than the 3 ‘ring’ connections you will need a suitable socket connector to connect with.

Technical detail is currently quite limited but we were told that the stated BBC plan is that everything associated with the Micro:bit hardware will be open sourced following the launch, which I certainly support.

The question everyone who sees the Micro:bit asks is ‘where can FullSizeRender2I get one’ ? The project has been delayed but there seems to be a level of confidence that the Micro:bit card will start being sent out to schools this spring, which I take to mean April.

So my thoughts, generally positive it is certainly great fun and has enough built in capability to allow some really creative applications – there were some interesting Hacks on show at BETT.  In that it does not need a dedicated screen or keyboard / leads it does address some of the concerns leveled at Raspberry Pi in the classroom. Against this you will need Internet access to use the programming tools including the emulator. I know from running STEM sessions in schools this can still be a challenge.

I do also see some problems with the ‘ownership model’ – one is being given to every UK year 7 pupil in this school year. The hope being that school’s and / or parents will buy them in the future. The problem I can see is that on one hand schools with tight budgets will try to hang on to them to use for the future years – depriving children say of the opportunity to code at home over the holidays. While on the other side given that there will no doubt be an initial supply and demand issue some children / parents are going to want to get their hands on them simply to sell on eBay -the initial production run is for 1 million parts so hopefully stop this in time.

To finish the Micro:bit should certainly make a positive contribution to getting more young people ‘into’ programming and computers, particularly given the work that has gone to reduce any barriers to access the programming tools. Compared to the Raspberry Pi it is less suited to building more complex and / or to ‘permanent’ projects. The big unknown is if the Micro:bit will build up the sort of the user community the Raspberry Pi has.

If you want to have a play, the website including an emulator is available now.


Posted in Uncategorized | Tagged , , , | Leave a comment

Meandering Pi @ BETT2016 RaspberryPi JAM

We will be at thlogo_bette RaspberryPi Jam @ BETT 2016 in London this Saturday,
running a show & tell table. In addition to showing how you can use the PiMuxClock and Pi_LCD boards to support Key Stage 3 & 4 computing activities we will also have the WordClock prototype board, some sense hat stuff and anything else I can fit into a suitcase !

Posted in Uncategorized | Tagged , | Leave a comment