Monday, February 13, 2017

UPDATE: Etsy & Tindie Shop Open

You might recall that a while back I made this wedding announcement trinket/figurine. Well not long after I decided to try and make a more marketable version. I started working on this in early November 2016 but then put it on hold as other projects took over. Recently I started working on it again and managed to finally finish it off in the weekend.

To give you an idea of how the figurine design evolved here is an image of the different revisions. The other thing this shows is my painful progress with driving SOLIDWORKS ;^)

Here is the final product:

And a video to show it all off:

Finally if you like what you see, you can get it from:

Monday, January 23, 2017

PROJECT: The Vidya Gaem Awards - 2016

As the name suggests the /v/ga's are an online awards ceremony organised by a small group of /v/ users. What you might not know is that these guys have been going strong since 2011. This year they decided to make the awards cyberpunk themed. Since this is my favourite genre I wanted to make something cool for the ceremony. 

In the end monoframe came up with a design for a neon sign which I made using side emitting fibre optic cable and a few powerful LED's. I was also lucky enough to have the design/build video chosen for the announcement trailer, which you can view below:

Sunday, November 20, 2016


My partner saw a neat tutorial on how to make a simple cellphone powered LED light, basically it uses a DC-DC converter to step the μUSB port voltage from 5V to ~3.7V. The problem I saw with the simple design was that there was absolutely no current limiting or over-voltage protection on the phone μUSB port, this can be a bit of a worry if your phone was designed without them in mind. So another idea was born, make a similar device that offered these safety features.

Component Selection

Having a look through DigiKey I found this neat little IC, the PAM2863ECR, which fit the description perfectly and even had the ability to control the current flowing though the LED (thus adjusting it's brightness). For circuit protection I added a 5.6V zener diode (MMSZ5232B-7-F) on the μUSB power line followed by a 0.5Atrip resettable fuse (MF-PSMF020X-2). Finally for the light source I went with the TL1F1-NW1,L(S which was a cheap yet powerful LED I managed to find on Element14.

Circuit Design

Next up I drew up a schematic in Altium and started the PCB design. One thing to note is that the LED and IC both have power losses with the LED being so significant that sufficient cooling (usually in the form of big copper planes) is required for the LED not to cook itself. As an experiment I decided to completely ignore these and see if I can get away with a tiny board (man I must have some sort of fetish for small PCB's...), here is that the board was going to look like:
And here is how it actually came out to be, minus the μUSB connector:

Lessons Learned

Surprise surprise the device did not function as expected here is why:
  • You guessed it the tiny PCB did not have adequate heat sinking capability, this caused the LED & IC to heat up to ~150°C, a fair bit over their rating... One interesting this I did get to witness was the LED slowly failing, you could see the current being constant but the brightness slowly fading away.
  • Something else I should have expected was the voltage drop across the resettable fuse. This reduced the IC input voltage from 5V to ~4.5V, and since it's minimum voltage is 4.5V it did not behave as designed. Removing the resettable fuse solved the problem, until the whole thing got hot again...
All in all i r8 an 8 outta 8, good reminder on the things to look out for when designing a circuit like this. 

Thursday, November 17, 2016

PROJECT: EMG Amplifier, Update #1

Sometime around mid this year I decided to make an Electromyography (EMG) amplifier circuit. This idea came alive because I like the though of human augmentation, and making something along these lines would be super neat.


So I set out on my journey of learning, reading many Masters/PhD papers to try and see what exactly makes an EMG signal and how to successfully amplify/capture it. From this I found:
  • The easiest way to capture an EMG signal is by using an Instrumentation Amplifier (IA), this is because unlike normal amplifiers these have a super high input impedance which does not collapse the waveform.
  • Another neat thing about IA's is that they have a high Common Mode Rejection Ratio (CMMR), this means that any unwanted signal present on both inputs (such as the annoying 50Hz hum) will get automatically attenuated/"removed".
  • One way which you can further process the signal is by using an active filter, this allows you to filter out any frequencies that you are not interested in. For example the range I was interested in was 50Hz ➝ 200Hz.


With that knowledge in hand I then designed the active filter circuit with the help of the electrical engineering bible (The Art of Electronics), and simulated the circuit in LTSpice:


After a few more iterations and additions I then decided to jump the gun and design an actual PCB:
Board all laid out and ready for OSH Park.

Breadboarding, what I should have done at the start...

My Band Pass Filter almost working as expected :D


Though this was the densest board I have made to date (2-layer 50mm x 30mm) rushing and making the board without first prototyping the circuit turned out to be a big mistake, as I learned:
  • Trying to assemble a board full of tiny components is tedious, especially if you don't have a solder paste stencil. 
  • Not all components are designed equal and some can withstand heat better than others, this is what happened to the heart of the circuit as all amplifiers were cooked to death ; - ; luckily I had a few boards and components to spare.
  • Trying to debug a busy board like this is not fun. In the future I should either make it on breadboard first, or add lots of jumpers to be able to bring sections in/out, plus lots of accessible test-points would not hurt as well.
  • Experimenting too soon can really mess things up. My downfall was that I decided to try and use two SIM card contacts as the EMG contact, when instead I should have started off with something that I knew would work (like this). Again this made debugging harder as I did not know if it was the circuit or contacts at fault.
  • As I mentioned earlier your IA needs to have a high input impedance, using the INA827 instrumentation amplifier was not good enough. Something like the INA826 (yeah I'm cheap) would have been better, 
  • If you do decide to power your circuit from a single rail (as in Vcc to GND not Vcc to Vss) make sure your amplifiers are designed for it. With my circuit I initially went with TL974 when I should have gone with something like MCP6004.
  • An addition to above, make sure that any active elements are also designed to work from a single rail. For my circuit the active full-wave rectifier was designed to work from a dual rail supply...
So now the project is on hold as other things have taken over, but I do look forward to coming back and getting this thing finally working :D

Friday, June 3, 2016

PROJECT: Wedding Announcement Puddycats

Good news! The fiance and I are getting married sometime in 2017 :D

To announce this awesome turn of events her and I decided to make a cool little gift for our family. In the end the trinket ended up being a couple of 3D printed cats that were lit up by an ever-changing rainbow from two RGB LED's. 

Circuit Design

Schematic wise the project is quite simple, just a single ATtiny25 microprocessor that "powers" some Red Green Blue (RGB) LED's. When I say power I really mean it provides a Pulse Width Modulated (PWM) sink for the LED's since they are common anode (notice how the anode of each LED is connected together), we can vary the brightness of each colour by setting the PWM duty cycle which in the end allows us to pretty much cycle though the colours of the rainbow (plus pink). Also all of this is powered by a single CR2032 battery as seen by the following schematic
Since the circuit is powered by a single coin cell battery I had to be somewhat efficient with the design, the end goal was to make the trinket last for at least a day. With that known I started looking for RGB LED's that:
  1. Were easy to solder by hand
  2. Had a good brightness at a forward current of ~2mA 
  3. Had a forward voltage drop of <2.9V for the Blue and Green LED, this is because a CR2032 battery has a nominal voltage of 3V
After a few orders from Element14 the best option seemed to be the ASMB-MTB1-0A3A2 

Next I picked the current limiting resistors (R1➛R6) such that the forward current through each LED (at max brightness) was ~2mA. As trivial as it sounds there is no simple solution to this problem, as the battery voltage is not constant throughout it's discharge cycle (it gets lower the more depleted it becomes) so finding a resistor that would limit the current to 2mA through the discharge process is impossible. After juggling factors like LED brightness, trinket lifetime, and average battery voltage I came up with an "optimal" resistance of 523Ω for the Red LED, and 75Ω for the Blue and Green LED.

Lastly when making any circuit that switches ON/OFF continuously (this is what the microprocessor does in this case) it's always a good idea to use some decoupling capacitors on the power rails. In my case since the ATtiny25 was output a bunch of PWM signals to be on the safe side I used two decoupling capacitors C1 & C2, both of which were the typical 100nF X7R ceramic type.

PCB Layout

Another goal was to have the trinket small in size, preferably as wide as the CR2032 battery holder. To achieve this I had to move to Surface Mount Technology (SMT/SMD), something that was quite new to me since all my previous projects utilized Through Hole components. With the packages specified I then designed the PCB in Altium, laying out the components in the following manner:
NOTE: I made all the footprints using Library Expert Lite, where as the 3D models were mostly simple body extrusions made in Altium. Come to think of it I should have used 3DContentCentral as they have all sorts of 3D models available at no cost.

Next step was getting the PCB's made, for this I went to PCBshopper to compare various fabrication houses. In the end I decided to go with OSHpark who are recognized for their quality and have the very distinctive purple/gold look. 

To get the boards made you need to supply the fab house with Gerber & Drill files for your design. Basically Gerber files define what each layer of the PCB contains, be it numbering/pictures on the top/bottom surface, tracks of copper, or solder mask. Whereas a Drill file tells the fabricator what drill size to use for each hole on the PCB. With OSHpark since I requested a simple two layer board the files I had to provide were thus:
  • Top overlay/silkscreen (GTO)
  • Top solder mask (GTS)
  • Top copper layer (GTL)
  • Board outline on mechanical layer (GM1)
  • Bottom copper layer (GBL)
  • Bottom solder mask (GBS)
  • Bottom overlay/silkscreen (GBO)
  • Drill location & size (TXT)
NOTE: Here I used the 1st Mechanical layer (GM1) to define the board outline. You can use any layer for this BUT make sure to not to use the same layer for other things like annotation, otherwise the fab house might get confused with the intended board shape... something that I found out the hard way.

Trinket Construction

To make soldering easier I decided to get the YIHUA 858D, a cheap hot air gun made specifically for soldering such small components. Here is a video of me soldering the "jelly-bean" parts with the hot air gun, something that would have taken much longer to had I used the soldering iron.

The rest of the components though small were easy enough to do by hand with the soldering iron.

Next up I printed the trinket body using my Prusa i3v 3D printer; the body consisted of a simple base which hid all the electrical components and two cats which got lit up by the RGB LED's. I should mention that the cat model is not mine and that you can grab it from the designer here. To make the cats hollow and the base filled I had to use two different print settings. For 0mm to 3mm the body (base) was printed with normal infill while for 3mm onwards the body (cats) was printed hollow; all of this was achieved by combining two different print parameters in Simplify3D. If you want the modified cat model you can grab it here.
Also to hold the PCB and 3D printed cats together I used countersunk M2x10mm bolts with M2 nylon lock nuts.

Trinket Programming

Programming the trinket would have been easier had I used a dedicated programming header like this, but since space was a priority I skimped on the header and instead used a SOIC chip clip. To give you an idea of how the programming went down have a look at the following video:

One of the interesting/unintended things I found was that an unprogrammed board would light the LED's red in colour, giving a neat way of checking the microprocessor status on each PCB.

The code for the above "rainbow scroll" effect can be seen below. If you plan to upload the code using an Arduino as the ISP (like myself) then make sure to grab this ATtiny library; if you want to know why then have a look at this post. To give you a summary the ATtiny easily supports two PWM outputs, if you want three/four (recall this project utilities three) then you need to jump through some hoops to get this functionality, using the above library does this for you and so makes programming a bit easier.
// Wedding announcement LED's                                        //
//                                                                   //
// PARTY HARD & VapeNash Ya'll                                       //
// Use this atTiny lib:          //
//                                                                   //
// ANTALIFE - 20.04.16                                               //

const int t_delay = 100; //100 seems best
const int pin_R   = 0;   //Red LED on PB0 (pin 5)
const int pin_G   = 1;   //Green LED on PB1 (pin 6)
const int pin_B   = 4;   //Blue LED on PB4 (pin 3)

void setup() 
  //Setting up muh e-peenz
  pinMode(pin_R, OUTPUT);
  pinMode(pin_G, OUTPUT);
  pinMode(pin_B, OUTPUT);

void loop() 
  //RED -> GREEN
  for (int rg = 0; rg <= 255; rg++)
    analogWrite(pin_R, rg);
    analogWrite(pin_G, 255 - rg);
    analogWrite(pin_B, 255); //Blue LED not used so stays OFF
  for (int gb = 0; gb <= 255; gb++)
    analogWrite(pin_R, 255); //Red LED not used so stays OFF
    analogWrite(pin_G, gb);
    analogWrite(pin_B, 255 - gb);
  //BLUE -> RED
  for (int br = 0; br <= 255; br++)
    analogWrite(pin_R, 255 - br);
    analogWrite(pin_G, 255); //Green LED not used so stays OFF
    analogWrite(pin_B, br);

Trinket Testing

Doing a quick test with my uCurrent (red box in photo) showed that the average current draw was around 7mA [I_draw], meaning that on a 240mAh [capacity] CR2032 battery the trinket would last [t_on] for just under a day and a half:

t_on = capacity ÷ I_draw
t_on = 240mAhr ÷ 7mA
t_on ≈ 34hrs

Actual tests showed that on a cheap CR2032 battery the trinket would last for just over a day, mission success :D

Trinket Showcase

Finally here is a video of a bunch of trinkets doing their thing:

Thursday, March 10, 2016

PROJECT: Workbench Upgrade

As expected all good things come to an end, and my once large workbench (or desk) had started to become smaller and smaller the more parts and equipment I gathered; this became very apparent with the addition of a Tektronix 2235 oscilloscope.

Thus I began a month long journey to upgrade my workbench to something more usable, the progress for this is below:

Sunday, December 13, 2015

PROJECT: Solar House

This year my partner and I managed to score some cheap solar powered lanterns along with some flickering LED candles at a garage sale, and with New Years being just around the corner I decided to convert them into a solar powered house with a nifty fireplace.

3D Models can be obtained from here, and build instructions can be found here.

Before I get into the nitty-gritty of things, below is the schematic for this project.

Solar Cells

Prior to actually using any solar cells it always a good idea to characterise them to see how well they perform. To do this I used your typical rheostat to place a variable load across the cell and then measured the developed current and voltage. The circuit for this can be seen below:
Once I had recorded a decent number of point I then plotted the measured current against the developed voltage and this gave me the well known I-V curve:
It should be noted that I excited the solar cells with a 7W LED light bulb and not a calibrated 1sun source, hence what you see is not an indicator of their true performance. Still the curves show that both cells are closely matched in performance (same Voc & Jsc) and so can be easily use in series or parallel configurations. 

Solar LED Lamp Controller, CL0116

It turns out that most cheap solar powered lanterns use a specialised IC (U1, CL0116) to control the charging/discharging cycle of a rechargeable battery (BT1) which is usually a single NiMH cell. From my understanding this IC is basically a switching converter which uses and inductor (L1) to efficiently boost up the voltage and in-turn power an LED; the anode of which would be connected to the LX pin and the cathode to GND. When the IC senses the solar cell is illuminated (can produce power) it enables the charging cycle of the battery, but as soon as light is removed then it starts to discharge the battery by powering the LED.

For some reason this IC is kinda hard to source as I've only seen it available on Alibaba.
EDIT: QX5252 is an alternative part that has the same functions and is much easier to find.

Candle/Flickering LED

If you happen dine out you might have seen LED powered candles which have this neat flickering effect to imitate flame. Well the interesting thing with these candles is that they are usually composed of a single CR2032 battery and what seems to be a single LED, but if you look closer at the LED package you would notice that it also houses a separate IC which controls the flickering effect (here is a really good breakdown of how these work).

These LED's are a bit easier to find and can be sourced from your local 2$ shop or eBay.

Combining It All Together

Now putting it all together sounds like a simple task: connect the two solar cells in parallel to SBAT(1), hook up a NiMH battery to BAT(2), and replace the simple LED with a flickering one.

Sadly trying this proved to be fruitless as it appeared that the output ripple voltage of CL0116 was too great for the LED IC to handle and instead the "flickering" LED stayed a solid colour.
To solve this I tried adding a smoothing capacitor (C1) to reduce the ripple voltage but soon found that using large values (>0.5uF) would completely turn the LED off; I believe this is due to a large inrush current during start-up which in turn causes the output voltage of the converter to collapse (kinda like some switching converter IC's have a maximum output capacitance).
After much trial and error I found that a value between 10-22nF gave the best result. Interestingly choosing C1 as 10nF resulted in a lower drawn current but also increased the chance of the circuit not working when trying a different flickering LED, hence to stay on the safe side 22nF should be chosen.

By simply having D1 in parallel with C1 resulted in a drawn current of around 70mA, a bit too high for my liking as most eBay auctions state that the forward current is 20-30mA. I found that a 10Ω current limiting resistor (R1) does the trick quite well and reduces the drawn current to ~30mA at very little cost to LED brightness. Also strangely enough placing R1 after D1/C1 gave the best results in terms of current draw; I'm in the process of getting an old school analog oscilloscope so hopefully will be able to give a better answer as to why.

Finally placing it all into a 3D printed house gives you something like this: