Sunday, 22 November 2015

Finishing the Sidereal Clock

This post is carrying on from the previous posts on the project to create a Sidereal Clock.  The previous post is here:

Sidereal Clock using GPS Module

Now that everything has come together and I have a working prototype with firmware written it's time to create an interconnection shield for the Arduino Mega.  The shield is really just a nice to have - I could just fix all of the separate modules down and wire them together but I'd like to do things a little better so I'm designing a simple interconnect shield to neaten things up a little.  The shield needs to have interfaces for the following modules:

RTC Clock module: 5 pins, SCL, SDA, SQW, +5V and GND
GPS Module: 4 pins, GND, +5V, Rx and Tx
I2C 20x4 Display Module: 4 pins, GND, +5V, SDA and SCL
Lipo Battery input: Bat+ and Bat-
Lipo Battery Charger: +V and 0V and Bat+ and Bat-
DC Boost Regulator Module: +Vin, 0V and +5V out and GND

The battery charger module and d.c. to d.c converter I bought from Hobby Components:

mini-lithium battery 5V USB 1 Amp charging module
dc-dc USB 0.9V-5V to 5Vdc boost step up power supply module-mini-pfm-control

These all need to connect to the arduino Mega.  Here is the schematic:

I then used the schematic to design a PCB which I will etch and populate.  I haven't discussed this yet but I've bought a Lithium polymer battery which has a maximum voltage output of 4.2 volts and a capacity of 2 Ah.  This is to try and keep the system running while it isn't plugged in.  It should provide 5 to 6 hours of battery usage.  The battery output will be connected to a battery charger and the DC boost circuit input.  The input to the battery charger will be fed from the VIN pin and the GND pins of the arduino mega (which will supply +5V from the USB connection.  This will charge the battery whilst a USB connection is present which can be provided by any USB wall wart of USB power supply.  The 4.2V lipo battery will also be connected to the DC boost circuit which will output +5V...this will be used to power the rest of the circuit.  This basically means that whilst the USB connection is present the system will be powered from that and charge the battery.  Without a USB connection the system will run on battery power until that runs out.

Here is the PCB layout - It's a little rushed but it will suffice:

Sidereal Clock Shield - Top Layer
Sidereal Shield - Bottom Layer

Once that was etched and tested (I got a couple of connections wrong) - I then got started with designing and laser cutting an enclosure.  I had already drawn something in Solidworks which is below:

I actually started designing this in Inkscape as I intended to use a laser cutter to design the enclosure. Using the inkscape extension tabbed box maker I came up with a rough design.  The tab size and general dimensions were selected because I had 4 mm laser plywood available and that means a multiple of 4mm would make the dimensions easy.  After I was happy that the output of tabbed box maker would work I saved the design as a DXF file and imported it into solidworks and then rendered it and added cut-outs for the 20x4 LCD display and the USB port for the arduino and holes for the support pillars.  I then re-exported the files back as DXF files and imported them into inkscape. Unfortunately during the import I messed up the scaling and the files came into inkscape incredibly small!
I then redrew the entire design with cut-outs and holes in Inkscape and laser cut some 4 mm laser plywood.  In future I will probably just use inkscape to design the lot!  Next I then stained and varnished the wood because I wanted a dark finish.  Here is a photo of the parts drying:  

Laser cut wood Drying

Once the varnish had dried I started to fit the internal parts like the arduino mega:

Exciting times...the rest of the sides and electronics followed, I couldn't help powering things up while I was putting the box together!

I still need to secure the battery and the charging electronics but that's everything complete.  I'm not fixing the lid down until I'm certain everything is working!

There are a few things that I think need some attention.  I've noticed that the battery doesn't last very long and if being powered by the USB connection takes forever to reach fully charged again.  I suspect that this is because the power draw of the circuit along with the battery charger is too high for most USB chargers.  I might fit a bigger battery and then suggest that it's left with the USB connection present in normal use.  All in all though I am very pleased with the results and I hope the final user will like their birthday present!

Here is a photo of the unit with the lid resting on top and a short (very boring) video of the clock running:

and...the ubiquitous video proving operation:


I have also been modifying the source code for this project which is available here:

Final revision of source code

Take care - Langster!