LED Matrix

As part of a project to find and organise small parts such as lego I’ve designed and built some RS485 addressable matrix displays.  These have a simple protocol to set an address (1 character) for each module and turn on one LED at a time in the matrix.   They are intended to be chained together.   There is a small step-down power supply on each board that drop the 12-24v power down to 5V using the LM2574 switching regulator.   Each board has a 4pin mini din connector which has the twisted pair signal, ground and power.



The project which will use these boards is a web application that can store where parts are stored in storage units.  The idea is that one LED in the matrix will light up to indicate the position of a part as you move through a pick list in the web app.  As only one LED lights up at a time it is possible to drive the single LED from the ATMega processor.

I originally wrote the server side project that stores where parts are in node.js, angular and MongoDB, however I have recently moved this to a Spring cloud application (mainly as a learning exercise).  The code is available at node or Spring.   The PCB layout was done in circuit maker and I will post it in a follow on post.   I am yet to check in the ATMega (Arduino) code but will package this up soon.

I’m currently updating all of this and also building some scales (connected on RS485) to weigh parts.   I’ll post an update in the next few weeks along with some instructions on how to get the code up and running.


Circuitmaker vs Eagle

I’ve been on the Circuitmaker beta since it went public and I’ve finally designed and order my first board.   The board is a RS485 addressable LED matrix (I’ll post some screenshots later).  I normally use Eagle for boards so there was a bit of a learning curve to get up and running with Circuitmaker.  In general I found Circuitmaker to be pretty good, however I’m likely to go back to Eagle for my next design.   Here are a few of the pros and cons:-


The 3D model was really useful for this design as it was a compact design were the matrix mounts on top.  The 3D model was great for checking clearences.  It also gives a slightly better indication of how difficult surface mount hand soldering will be.

While routing DRC are applied which allows you to easily and automatically avoid DRC issues.

Bigger boards than Eagle (free).


The component system can be slow and awkward to use.   All the components are looked up on Civa and have to be fully specced (i.e. values).  This is good if you wanted to produce a BOM that you can order directly from, however for the things I do I’de rather have configurable components which I can adjust and then manually enter the BOM with my supplier of choice.  You also need to have a network connection at all times.

In general I found it has a lot of spinners while you wait for network.  Even clicking a component on the schematic has a significant delay.

Windows only.  I’m normally a Mac user and I like being able to share my designs between my Mac an PC.

It has its own version control system.  As I like to store my designs on github which I can link too, the fact that Circuitmaker has its own internal eco system, which doesn’t seem to be easy to share outside Circuitmaker, is not ideal.  Some users have expressed issues with not having closed designs.  Personally I don’t think this is a problem as all my designs tend to be open.

Gerber export was tricky as it doesn’t output a board outline by default.  You have to add a keep out layer for the board shape.


I think if Circuitmaker was a little less sluggish and maybe had a better component system  it would be preferable to Eagle in a lot of cases for me so I’ll be looking at future updates to see if the situation improves, however for the time being though I’m going to go back to Eagle.

Ethernet motor control board

I’ve got a prototype motor control board up and running.   The board has 4 motor channels and is based on the ATMega and ENC28J60 Ethernet controller.  It has 2 through hole mounted H-bridges to control the motors.   The schematics are available on github and some example code will be there shortly.

I’ve done some testing on channel one and it seems to be all working correctly.   I’ve built a simple test UDP server using the Arduino libraries and this is all working correctly so far.   The only issue is that the original design did not use the PWM pins for the enable lines so there will need to be some bit banging for speed control.   I intend to update the design in the future to enable this.

A few pictures:-

Motor controller assembled

Motor controller assembled

Testing the motor controller

Testing the motor controller

These will eventually make it into the underwater ROV.   The idea was to control over ethernet and send video back over ethernet using a cheap IP camera.


I have received the latest revisions of a few boards I recently ordered.  I assembled the the newest Gardenstation board and there was an issue with shift registers (MR was being held low).   Some board hacks got it working and I’ve fixed the Eagle file and switched the display header pins around (will update in github shortly).

I’ve assembled on ROV control board although at present I’m not able to burn the bootloader on the AVR.   I suspect there is some issues with the soldering of the ENC ethernet controller.   Elecrow removed the solder mask between the ENC chip pins which made it extremely hard to hand solder.

I’ve embarked upon a reflow oven project (based on a Kmart $35 toaster oven).   I had a quick test at the weekend and managed to successfully reflow some parts to a test board.   The thermocouple I’m using has been slow to respond (my voltmeter one is much quicker) so it got a bit too hot.   The Arduino control code is available here https://github.com/markpudd/reflow_oven.

Quick Update

This is a quick update as the blog hasn’t been updated in a while.   I’ve been traveling so haven’t had a lot of time to post.   The arcade machine is finished bar the marque at the top of the cabinet and I will try an post some photos next week. I’ve made some minor changes to the Garden Station in order to add a power light and fix a few minor issues in time for the Australian spring/summer!  I order new PCBs from http://www.elecrow.com which I received last week however I’m currently in the US so won’t be able to assemble until next week. Finally I designed a small board to provide AVR with Ethernet and an H-bridge to use in a ROV project I’ve started to build.   The board parts have all been received and are waiting for me when I return home next week.   The design is on github – https://github.com/markpudd/rov_control.   I’ll probably hand solder the first one but I’m thinking of making reflow oven for future projects.

Arcade Control Board

I’ve finally got round to posting about the raspberry pi arcade.   I’ve build an ATMega based board to convert all the controls to SPI for the raspberry pi, modded the ada-friut retro arcade library to use the SPI based control inputs and etched a PCB for the control board.

I home etched the PCB using the toner transfer method which I find to be a bit of a pain to get a decent result.  The best way I’ve found is to print on magazine paper, then iron on for 5 minutes and finally run through a laminator four or five times.  Here is the result:-



The board does a few thing.   It has 2 9-Pin D connectors for the player 1 and player 2 controls.   The layout is the same as an old atari joystick (in theory you could plug in old Atari comparable joysticks).   The unused pins on the D connector are used for the extra buttons and the player 1/2 buttons.  The joystick axis connect to analogue inputs on the ATMega to save a few pins.  There is also an input for a coin mech to add credits, at the coin mech requires 12v the board requires a 12v and 5v supply.   The 5v supply goes thorough a regulator so that the board runs at 3.3V (8Mhz) this removes the need for logic level conversion between the board and PI.

The above pictured board had a few issues (it also had a zener for the coin op mech which has been removed).   I put a few jumper wires on the bottom to correct the issues, most of which were due to eagle not connecting nodes so I should probably pay more attention to the ERC check.  An updated design is checked int github at https://github.com/markpudd/PiArcadeBoard.  Here is the populated board connected up:-


The other thing I’ve done is sprayed the cabinet black, added the coin mech and stated to put on the plexi glass:-


Only a couple of more things to finish (bevel and marquee) so will post later in the week with the finished result!


Arcade Controls

The Raspberry Pi arcade now has controls!


The controls have been connected to an Arduino which then uses SPI to connect to the Raspberry Pi.   The following hardware design was used:-


Its important to use a logic level converter for the 5v to 3.3v conversion.

After hunting around for good ways to simulate key presses on the Pi I stumbled across the Adafruit retrogame code which uses GPIO as inputs.   I’ve forked this on github and changed it to request the state of the buttons over SPI and update the presses.  It currently polls and doesn’t seem to be using much CPU, although it would be possible to use a separate GPIO pin to tell the Pi that there is a change in state.   The code is available at https://github.com/markpudd/Adafruit-Retrogame.   This also includes the Arduino code to connect the inputs too.

The SPI protocol basically send an 0xFF command to the Arduino which returns 3 byte, which are P1 status,P2 Status and Aux Status.   The Aux status is used for P1/P2 button and the coin mech.

I’m currently building an input board to replace the Arduino which is basically the ATMega broken out with some connector for P1/P2 and aux.   I’ll publish this at the end of the week.

I also added some audio amplifier and speaker this week.  There is still a bit to do on this project such as getting some artwork printed, painting the cabinet and fixing up the monitor mounts!



Raspberry Pi Arcade

I been considering build an table top arcade cabinet for a while.   Since I’ve had some spare time lately I decided to start a project to build one.  I wanted to use as much stuff that I had around to keep the cost down so I decided to use a Raspberry Pi for running Mame, an old VGA monitor, some spare particle board and an old ATX power supply.  I’m also keen to have the potential to change to a JAMMA board or old PC in the future.

For the cabinet I looked at a few internet designs (weeCade and some others) but decided in the end to just create a rough sketch in 123D and build based around the size of the monitor I had.


The next thing to do was to order in some arcade controls.   I used http://www.austinamusements.com.au and ordered their $30 bundle and a $17 coin mech.  I fitted a one player control board to just get things up and running.   I also needed to get a HDMI/VGA converter which came from ebay.   For audio I’ve used a cheap 1W amplifier kit and two 1W speakers.  


Time to wire the Pi up with the monitor and audio and have a quick test.   For the test I have not wired up the control surface so wss using a keyboard.   The Cameleon Pi distro has Mame installed so it was pretty easy to get up and running.   I had to changed the HDMI mode to 2 in the /boot/config.txt which fixed the audio out (from the HDMI adaptor) and as I was change the config I also increased the over clock to 1Ghz.   At this point everything seems to be working apart from the controls!ImageImage


The test control surface is built but not interfaced to the Pi.  I’ve had a few ideas on ways to do this:-

  • Buy a USB keyboard control surface interface.   There is some boards available for this purpose or the other option was to try and make one from an old donor keyboard.  I don’t have a donor keyboard and I didn’t want to buy the convertor.
  • Interface the controls directly to the GPIO on the PI.   This was my original though cut to it being reasonably simple however there is a limited number of pins.  For a 2 player, 3 Button controller with P1/P2 buttons and coin mech I’de need 17 inputs.
  • Using an IO expander IC on SPI.  This wasn’t a bad idea but I need to order in some expander IC’s…
  • Use an Arduino to control get the inputs and convert to SPI.  This is option I’m going to go with as I have all the parts.   I am short one input as I am using an UNO so will put the coin mech either on a Pi GPIO or make it use the same as P1/P2 pressed together which would also allow adding credits without using coins an alternative would be to use multiple inputs on one analogue input using a resistor network.  Using the Arduino also has the advantage of allowing extra features easily (such as auto fire) and has analogue inputs if required.

As I chosen to run with the Arduino solution I’m currently doing a little research on how to get SPI working between Pi/Arduino which I’ll post on once working!

I’m also looking to get a backing printed for the control surface which I will then cover with some clear plastic sheet.



Back from Holiday!

I’m back from holiday and have updated the gate opener code.  I’ve changed my github username so the code is now at https://github.com/markpudd/gate_opener.   There is a few changes:-

  • Added an iOS client.  This is pretty basic (no design) but has a button to open and a geo-fenced area to allow the opening to happen automatically as you get near to the gate.  In the setup you can add the shared secret for the Arduino and set the centre of the geo fence.  The fence is set to 8 meters at the moment but I’ll look to add a slider to widen this in the future (a non round geofence would also be cool).
  • Fixed up the Arduino code.   On review of the Arduino code today there was a lot of issues.  These included invalid checking, not reading the post parameters correctly and few other issues.   I’ve fixed these up now however the code needs tidying up.  The code was originally based on the example web server for the Arduino Ethernet shield which I think has caused some issues, if I have some time I’m going to re-write from scratch…..

I’ll post the hardware pictures in a future post.


Gate Opener

I’ve posted a new project to github (https://github.com/markmoro/gate_opener).   The aim of this project is to make my driveway gate open as I drive up to it.   It works by using geo fencing on my phone to detect that I am close to my house and then send a message to an Arduino with ethernet shield to open the gate.   The opening it self is done with a spare gate remote that has had the switch replaced with a MOSFET.   This project is still in progress.

The key thing about this project was to make sure that only some one with a correct code can open the gate.   To do this there is a few steps:-

  1. Both the Arduino and the phone have a shared secret key
  2. The phone requests a token from the Arduino
  3. The token is appended with the command (‘open’ string) and an HMAC digest is created with the token
  4. The digest is sent as a POST parameter to the Arduino
  5. The Arduino re-creates the digest and verifies the received digest matches
  6. The gate is open (sends a 500ms pulse to the MOSFET gate to open the switch).

The above scheme should prevent any replay attacks as all of the requests are unencrypted (there is no SSL for Arduino).    There is also a test Python bottle server and test bash scripts to test both sides of the communications (in the webapp folder).

There has been a few issues with the MOSFET circuit which I will fix in the next few days and post!