Wearable Tech

Enter Your Electronics & Design Project for a chance to win a $100 Shopping Cart!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

ledog logo

Introduction

When it was commented that there was only one applicant for the Wearable Tech Project14 I joked that I was going to wire up an LED to a coin cell and try for second or third place - well I generally like to put a bit more effort in. I was going to enter the wearable wristband I have been trying to make for my MKR1300 LoRa Project but it has fallen way short of the mark and I'm still struggling to make the PCB.

 

A month ago I bought my dog a nice flashing unit to go on his collar so he could be seen in the garden or when running about late at night....he managed to chew the unit up within about 30 minutes. It also was not very bright and did not have the fun factor of being able to change the pattern.

 

My Submission to Wearable Tech

Enter "ledog" my LED for dogs. I'm entering it into the Wearable Tech - I didn't see anything that said it had to be worn by a person. I have used an LED and a coin cell but have also added a push switch and a microcontroller. I was trying to keep this unit as small as possible and therefore decided to use one of my PIC10F200 6-pin SOT-23 units (sneeze during assembly and you'll need to buy another ). That was probably a bad decision as they have only 256 bytes to play about with. Therefore time to switch from the XC8 compiler back to using MPASM. My initial code effort used about 80 bytes.

 

Basic Design Calcs

I used a Kingbright LED (Farnell 208-0005): 11Cd @ 20mA and a max current of 30mA...I drove mine at the limit of the PIC's single IO pin value of 25mA. This required a resistor of 33 ohms. I opted to use a through hole in case I wanted to adjust it later. However towards the end I realised this may be well over the absolute current that the coin-cell can deliver (discussed in Summary).

 

Time for a PCB

To mount this small device I checked the pin pitches and found it didn't even match the 0.05" of my smaller dev boards. I didn't really want to spend days making a PCB on Eagle so decided to go free-style. I cut a small section (approx. 25mm x 35mm) of double sided board and cleaned it up with fine emery paper. I then used a Sharpie pen to draw the circuit. Etching was a similar adhoc process.

{gallery} PCB Layout

A piece of double sided PCB, cleaned off.

Plain Double Sided Board

The components to place on this board

Components to place

The main component side of this PCB

Main component side

The LED side of the PCB - through holes were guessed

The LED side

I did not want to heat the whole jar of Ferric Chloride and so filled a large jam jar with very hot water, cut a section from an old plastic egg box, filled that with a small amount of etchant and floated it in the hot water. Holding the board with tweezers I was able to wash the etchant over the board with a small paint brush (although the plated metal ferrule on it soon suffered from acid attack).

 

The PCB didn't come turn out well and I may have abraded some of the Sharpie tracks during the development time leading to the tracks being attacked  - the process took about 10 minutes and towards the end I stopped short so as not to loose the detail I had already achieved. I planned to cut away any extra track etc using a scalpel if required.

{gallery} Eteched PCB

The component side of the PCB after etching - note the Sharpie has also dissolved in places

The component side after etching

The LED side of the PCB after etching - the remaining copper at bottom was from holding in tweezers.

The LED side after etching

After cleaning off Sharpie - close up view showing track erosion (some solder will fix those)

After cleaning off Sharpie - close up view

Most of the 'ledog' logo detail has been lost !

ledog logo - close up of PCB

Construction

I also could not find my tin of fine drill bits (having tidied up back in the Autumn) and instead used a fine ball headed 'drill' (like a Dremel or dentist's bit) to make the through holes.

 

I soldered on the parts as required, added some wire links, tested, made good the gaps in a couple of tracks and was ready to program it up using MPLAB IPE.#

{gallery} Populated Board

The main component side

Main component side of PCB

The LED side of the PCB with the high brightness clear LED at the bottom.

LED side of PCB

A 0603 SMT resistor to pull up the MCLR line nested next to the PIC10F200...you can even see it is 4k7

The MCLR pull up resistor

The Program and Programming

Programming the PIC10F200 in assembly is quite easy as there are only about eight registers for the system and would therefore make a simple unit to learn from (although I would purchase the PDIP version rather than the SMT ones). The whole program currently occupies 114 bytes and could probably be reduced further with some clever programming (and removing the FLASH routine that is not used).

 

The PIC microcontroller is so basic there are not too many registers that can prevent the device from running but at the same time it lacks the usual range of peripherals, memory, program space and stack depth to do complex things. But for this task it seems enough. I fell foul of the stack during code development as I called the DELAY2 from DELAY3 but having also called that routine I had gone past the stack depth of two and the program crashed. To remedy that I incorporated the DELAY2 into DELAY3 (used more bytes but overcame that limitation).

 

Debounce important and perhaps not ideal as I have implemented it but a 50ms delay is about right to get responsiveness. The design stays in the modes and returns to the Finite State Machine(FSM) to check for switches. This is OK for most modes but on the last mode, where the flash duration is longer, the button needs holding until the delay has expired and control is passed back to the FSM.

 

The code can also be found on my Github page here https://github.com/726f64/ledog

 

Programming was using the MPLAB IPE software and my trusty PICKIT3.

 

Finishing Off

Today I will be finishing off, encapsulating and mounting to a suitably strong tag - perhaps aluminium. I'll try and get the final pictures posted before the #wearabletechch deadline tomorrow. I will also need to find a way to seal the switch whilst still allowing it to work.

 

Summary

The effort of making a PCB, even of this poor quality, was still worth while. The microcontroller was lacking in just about every aspect of specification but actually was still capable of making a working unit (under 256 bytes of code, 4MHz, 6 pin device, no external components, 2 deep hardware stack and only 16 bytes of user variable storage).

 

There was one huge mistake and that was that I used a coin-cell holder that was too small for the coin-cell I actually have (a CR2032). I need something approximately 12mm diameter (or a new holder). I have also noticed the specifications for the coin-cells state that the CR2032 can only manage 15mA pulsed and I am driving at 25mA - this may result in early failure of the battery in the longer term so I will likely reduce the current limiting resistor accordingly.

 

 

Rod

 

[I used https://www.onlinelogomaker.com/logomaker/  to make the logo]