Saturday, 8 October 2016
Wednesday, 10 August 2016
Electromagnetic Field Festival LEDs
I've been fortunate to attend the 2016 Electromagnetic Field camping festival this year. This is a 3 day event in the UK where geeks get together for a fantastic festival of talks and workshops of all things geeky.
In preparation for the 2016 event I ordered some WS2811 RGB LEDs to adorn my tent:
This uses the Adafruit Neopixel library example code, but is modified to do an RGB fade from the centre outwards:
I was asked how I did this so here is a quick tutorial:
1) Buy WS8211 LEDs from Amazon.
2) Buy a high current 12V to 5V power converter from Amazon. This needs to be capable of providing at least 3Amps.
3) Buy an Arduino Nano. The original boards can be bought in the UK from places like Cool Components. However, Chinese clones are available from places like BangGood. However, these devices will need a driver installing before they can be used with Windows.
The Arduino shows up as a serial ports (e.g. COMXX), but the clone devices use a cheaper alternative serial chip than the originals, hence the need for a driver. Here is an Instructable on getting it working.
The LEDs have 3 connections:
+5V power in.
GND
Data.
The data can only go in at one end and this is not clearly marked. It's best to check that everything is working before tidying everything up.
The 0V and +5V terminals are difficult to identify. By peering through the transparent housing though it is just possible to see the terminals marked as +5V and GND. The remaining terminal is the data line.
Note that the connections are the same on opposite sides of the printed circuit board.
Wire everything up as below. The converter is used to drop the 12V input to 5V for both the LEDs and the arduino.
Download the Arduino project here. You will also need to install the Adafruit Neopixel library. See here for details on installing Arduino Libraries.
Remember, if it doesn't work first time, try connecting to the other end of the LED strip. And feel free to give me a yell if you are having troubles.
Please note that this is a guide only. You follow this guide at your own risk. I am not responsible for any errors, ambiguity, truth or omissions.
Saturday, 26 March 2016
Micro:Bit
At Hack Oldham's monthly Hack The Library event today I got to play with the soon to be released BBC Micro:Bit.
This is a small PCB with an ARM MCU. It has on board Bluetooth, compass and accelerometer peripherals. And also come with a 5x5 programmable LED matrix and user buttons. The plan is to give one to every year 7 (11-12) kid in the UK and just let them get on with it.
There are several ways to program it, from Scratch like block programming to an implementation of Micro Python.
I tried the block based interface first, but as a classic programmer I found it unwieldy so I got straight in with the Python.
The web based Python editor is ok, and the peripheral documentation is reasonable. I would have liked to see some more detail included though. For example, the accelerometer is fully supported in the API. But it would have been nice to have it documented on the numeric range that the device would output. Not a show stopper, but easy to add to the docs.
After writing your code, clicking the web 'download' button literally downloads a .hex file straight from the browser to the local file system. When the Micro:Bit is connected to a Windows PC, it shows up as a removable drive. The file needs to be copied into this drive, where after downloading it is immediately executed.
If the Python script has any errors, the error is displayed as scrolling text on the 5 x 5 LED display. This is useful, but it would have been great if this could also have been dumped to a text file in the mounted drive. Waiting for an error such as : "Error line 60: Syntax Error" to scroll along a single character display can be frustrating.
Anyway, after half an hour or so I'd managed to write a small game where by tilting the board, a statically illuminated LED is moved towards a flashing LED. When the two meet, a Pacman symbol is flashed (it's a hard coded image, amongst others, in the Micro:Bit) and the two LEDs are randomly re-positioned.
Saturday, 9 January 2016
Laser cutter + surface mount MPU programming
I designed a PCB that has to fit in a space that is very constrained. The PCB uses SMD micro controller, and there is no space for a dedicated programming connector on the board.
To solve this I simply placed PCB pads connected to the MPU programming pins. I ordered some spring test probes from BangGood. If you are willing to wait a couple of weeks this is the cheapest place for these.
The PCB design software I use, DesignSpark allows me to export a mechanical .dxf file for the PCB.
I imported this into my laser cutter software to allow me to cut a 3mm MDF sheet with holes where the MPU programming pads are:
It's a bit over the top using a laser cutter for this, but: 1) It cuts quicker and more accurately than I can. 2) The probes have an odd diameter, 1.3mm which is a drill size I don't have, but the laser can do any size hole.
I cut two of these, and used them in parallel to align the spring probes:
I ran the hot melt glue gun between the two plates to fix them.
And epoxied the wires to the molex connector that plugs into the PicKit3 programmer and the jig itself:
This jig enables me to simply press it onto the PCB. The spring contacts guarantee a good connection. And programming takes a few seconds. It's quicker than plugging a MPU into a programmer, and then transferring it to the target board.
Subscribe to:
Posts (Atom)