Showing posts with label general electronics. Show all posts
Showing posts with label general electronics. Show all posts

Friday, December 9, 2011

Battery pack for medical device


Any guesses as to what I've been up to?  It certainly looks a lot more dangerous than it really is.  The object on the left is an electronic ambulatory infusion pump used by medics.  The object on the right is a makeshift battery pack I put together to power the pump.

A little while ago a friend of mine came to me with a problem - he was running an in-vivo experiment using one of these pumps to provide a continuous nutrient supply; the problem was that he needed to run the pumps continuously throughout a two week experiment. The pumps only accepted AA batteries and would run out of juice after only 4 hours of use. Having to go to the lab and change batteries every four hours sounds a bit too much like experiencing the sleep debt of having a very young child... So, he asked me if there was a quick and easy way to improve the situation.

Connecting the pumps directly to the mains was out of the question; they needed to remain portable and untethered. So I thought we could add an external battery pack instead which would house larger, D size, batteries to increase the available power supply.

These pumps cost around $800 each, so I wanted to make the least invasive upgrade possible - yes, I'm a scaredy cat. Rather than ripping them open and soldering directly onto the circuit board, I decided to make some fake AA batteries to interface with the internal battery terminals. A couple of screws at the end of correctly sized dowels should do the trick. So, I measured an AA battery (length and diameter) and headed over to OSH to pick up some doweling (I know... I feel like I was cheating on home despot).

I cut two AA sized cylinders and decided on the right length of wire. I attached the wire to the ends of the dowel using a circular crimp terminal and a couple of wood screws. I had to drill a small hole in the pump casing in order to have the wire accessible, I threaded the wire through the hole and attached a mono jack plug to the end. For some reason I have a bag of these plugs and paired sockets sitting on my workbench... I figured they'd make life easier when replacing batteries by allowing the pump and battery pack to be separated and, if needed, I could make a few packs which would allow even quicker battery replacement.

If you've read any of my other posts you won't be surprised to hear that I opted for PVC pipe when making the main body of the battery packs. It turns out that D batteries fit snugly in 1 1/4" PVC piping, which is readily available in Lowe's/OSH/Home Depot.

 I bought some single D battery holders from RadioShack so I could cannibalize the springs (and wire). I dissected them using a proxxon (a dremmel variant gifted to Lin by my PhD buddy Claire) and glued them to a couple of PVC end caps.  If you look at the picture below you can see that one of the end caps consists of two pieces where one slides onto the main body and the other screws onto that piece. I glued the spring onto the inside lip of the larger piece, drilled a hole in the smaller cap to fit the jack plug and soldered it all together.  The connecting wires were passed through small holes drilled in the sides of the cap.  The black tape you can see is to secure the wire that connects the lower terminal with the jack socket.  I thought about passing the wire down the inside of the case, but I figured that having the wire on the outside would make it very obvious how far the wire can be stretched safely.  If it was on the inside someone might pull the cap off too hard/far and damage the battery pack - not good halfway through an experiment!

It turns out that the modified pumps and battery packs worked well.  The D batteries supplied enough juice to run the pumps at full pelt for over 16 hours;  Result!

Tuesday, November 1, 2011

Techliminal PCB design workshop

A while ago, as part of the bay area workshop weekendTechliminal held a 3 hour "introduction to PCB layout" class instructed by Malcolm Knapp.  I'd tried using EAGLE a year ago when I first wanted to produce some schematics for my blog posts, but I found it a bit unintuitive and very frustrating.  I went along to the class hoping it would be a quick and easy way to get to grips with schematic design and board layout.  In short - it was.  Malcolm is a really good teacher and I think everyone in the class got to grips with the software pretty quickly and got a lot out of the session.  This course is being run again this coming weekend; if you're around and want to quickly get to grips with Eagle I strongly recommend signing up (just click here)!

After the class I headed home and immediately created my first schematic and board.  There are a few I want to make but I figured the simplest would be a board for the traffic lights I made for the kids ages ago.  I got a little bit carried away and made designs for a POV writer, an RGB LED night light and for a smaller version of "Dr Boardman's Color Conundrum".  Here's the first schematic for the POV writer:

And here's the board layout:



I was immensely proud to be able to put this together.  I know this is simple stuff for many people, but this isn't the easiest software to work out late at night (the only time I have available).

I submitted my gerber files to the DorkbotPDX PCB order and waited (eagerly).  The boards cost $4 per square inch (for which you get 3 copies of each board) and arrived a couple of weeks later. 

Here they are fresh from the fab:

That's four designs with two boards positioned so you can see the front and back of each (the boards are actually double sided).

I've had a chance to solder parts on to all of these.  Of course I found a couple of mistakes and oversights in these first designs, but that's no surprise really.  This is all a learning process.  They all work though - which is a big shocker!

All in all this has been a great experience.  It's fantastic to go from idea -> design -> PCB -> working device; this is very empowering.  I'll write more about the individual boards later, but for now I just wanted to post something to give a shout out to Malcom and to encourage anyone interested to head over to the workshop.



Monday, March 22, 2010

Saving a Disney Princess Remote Controlled Car

During a trip to Savers I spotted this Disney princess car:

I noticed the sensors in the head and tail lights, they looked like IR receivers. At first I thought the LED in the body of the car was an IR LED and that the IR receivers detected the IR light bouncing off objects in the cars path (not that the tail lights would make much sense in this context), but when I got it home and put batteries in it, the LED turned out to be just a colour changing LED put there for decoration.

A while back I headed over to Noisebride on a Monday night to check out their circuit hacking/soldering workshop (hosted by Mich Altman). During the workshop I put together one of Mitch's kits - "The Trippy RGB Waves" kit (here's my Noisebridge post if you're interested in reading about the experience). The point is that this gizmo uses an IR LED and an IR receiver to detect overhead objects. The LED pulses IR light at 38KHz (not to be confused with the actual frequency of IR light which is ~ 3THz or 3 x 1012 Hz) which the IR receiver detects if there's an object above the LED reflecting the pulses back down.

I wondered if the car has a similar set-up and was just missing the remote control (which would have a pulsing IR LED). First off I tried a regular remote control, which had no effect so then I tried pointing the Trippy RGB LED kit at the car and voila! It reacted to the light. So, I set about creating a wand/gun for the kids to use to interact with the car.

First off I tried setting up a 555 timer to pulse an IR LED at 38KHz. It worked but the signal was weak (maybe I got the values off a little). I decided to use a microcontroller instead. The ATtiny range are pretty cheap - I bought some ATtiny45s for $1.20 each which is ~3x the cost of a 555. The hardest part was finding/creating a housing for the circuit. I looked around and decided to make my own out of PVC piping. They look like tiny guns and work a treat :)



Methods:


Here are the final "guns".



Ingredients:


The pipe is 1/2" PVC piping from Lowes (Home Depot have it too).
  • PVC elbow joint
  • PVC pipe (cut to a v.small length 1 1/2")
  • PVC pipe cap
  • Coin battery holder (3v, 20mm)
  • 8-pin DIP socket
  • momentary push button
  • IR LED
  • ATtiny45 (originally made with an ATtiny13).

The plastic dome is the case from a 25c toy from our local taqueria. The base fits snuggly on the end of the elbow joint and I've used it to cover the battery holder in the final 'product'. The piping paraphernalia was all left over from the marshmallow-gun fun.

The wiring is all very straightforward. The hardest part was adjusting the elbow joint so that my coin cell holders fitted snuggly inside (and getting the pushbutton in place).

So, first off is to drill some holes: 1 in the end cap for the LED and one in the elbow joint for the pushbutton. Then I used a rotary tool (Proxxon) to carve out some of the innards of the elbow joint until the battery holder fitted snuggly inside.

Then I soldered one short and one long lead to the pushbutton and fitted it into the elbow joint (see below).



Then I soldered a long ground lead to the battery holder and connected the short positive wire from the pushbutton and placed the battery holder in the end of the elbow joint.



Solder on the DIP socket. Using a socket was a great choice for me because it turns out that the code I was running was not getting the best results from the car. Having the socket let me replace the uC after I'd worked out the kinks. I guess it'll also let me easily recover the uC when the kids are bored of this toy. I stripped a little bit of insulation from near to the end of the ground lead and soldered it to the ground pin (rather than adding a couple of wire ends at that point).



Then it's just a matter of connecting the LED, placing the uC in the socket and fitting the remaining piping.





I made two so both girls could play. Although that also opens up a huge opportunity to fight over who's in control as well...



And here's the code (for some reason the car reacted best if the IR was pulsed for ~170 microseconds with a 400 microsecond pause before the next set of pulses):
/*
* IrLedPulse.c
*
* Distributed under Creative Commons 3.0 -- Attib & Share Alike
*
* Created on: Dec 26, 2009
* Author: Paul
*/
#include <avr/io.h>
#include <avr/delay.h>

#ifndef F_CPU
#define F_CPU 1000000UL
#endif


// Use Timer 0 to pulse the IR LED at 38KHz
void pulseIr()
{
TCCR0A = 0 | (1 << COM0A0) | (1 << WGM01); // COM0A0=1 to toggle OC0A on Compare Match

TCCR0B = 0 | (1 << CS01); // 1/8 prescale
OCR0A = 104; // to output 38KHz on OC0A (PB0, pin 5)

_delay_us(170); // delay 170 microseconds

// turn off Timer0 to stop 38KHz pulsing of IR
TCCR0B = 0; // Stop Timer0 (turn off IR emitter)
TCCR0A = 0; // Disconnect OC0A from PB0 (pin 5)
}

int main(void)
{
DDRB |= (1 << PB0); // set PB0 to output
PORTB = 0xFF; // all PORTB output pins high (LED off).
while(1)
{
pulseIr();
_delay_us(400);
}
}

Tuesday, November 3, 2009

LED Tester Mark II



Ok, so the last one I made had a serious flaw... it'd burn out any LED that couldn't take 3V... Oops! I recently bought a new soldering iron (variable temp, xytronics from allelectronics.com) and wanted to play with it, so I thought it was time to replace the LED burner with an LED tester.

Basic ingredients: wire, some resistors, an 8 pin DIP socket, a pushbutton and some perfboard. I treated myself to an automatic wire stripper the other day ($8 from Fry's), it's great! I've been using it quite a lot. No need for it in this project really, but I like to show off my toys.
Here's the basic wiring and soldering for the resistors and socket (this is what I messed up in the first iteration):


At midnight I ended up with the following "finished" product (I should have learned by now not to start late at night...):

The problem was that I'd completely wired the push button wrong. In the above wiring, the power lines are connected to the positive and negative rails on the DIP socket, which meant the LEDs lit up as soon as they came in contact with the DIP. On pushing the switch the LEDs would turn off because the positive and negative leads from the battery holder were shorted... bah!

A few days later, I came back and repaired it (button connects and disconnects +ve terminal, -ve terminal is wired directly):

A view from the top.

Single LED test. You can see the multi-LED test picture at the top of this post.



The soldering iron is much better than the Weller I'd bought (it was a bottom of the line weller min you). It heats up fast and the tip is noticeably better quality. The power cord, however, is very thick and reduced the maneuverability of the iron.

Sunday, November 1, 2009

Flashing Bat Eyes




Very simple project. You just need a 555 timer a couple of resistors, a capacitor, a couple of LEDs and a talented wife to provide a bat ;) I think she'll be adding a post on making the Halloween bats so I'll link to it once it's up.

I used the following online calculator to work out the values for R1, R2 and C1 for the standard astable 555 set up. I ended up with: R1 = 3K Ohm, R2 = 570 Ohm and C1 = 100uF (mainly because that was the combination of components that I had lying around and that gave an acceptable output wave). I didn't bother adding a switch to this one, I'm not sure why as it'd be very easy... here's the fully wired up project:


Did you notice the 9V battery clip onto an 2xAA holder? Weird eh? Useful though. I think I picked up the battery case at radioshack. You'll also have noticed that I decided to try a free-form (no perf-board) approach. It was a bit fiddly, but worked out ok. I still haven't found a combination of 3rd hand/clamp/foot/nose that works for me for these fiddly soldering projects...

Here's a couple of close-ups of the soldered 555 itself:

Most of the time I had the 555 held with a crocodile clip (on the 3rd hand). Unfortunately, I bought a really cheap 3rd hand from a market and the crocodile clips are not stable so everything kept moving around whilst I was trying to work on it... bah. At points I ended up jamming the chip into a corner of the 3rd hand base whilst pushing at it with the soldering iron. Not very elegant or skilled... any advice is greatly welcomed!

All that's left was to poke out some holes for the bats eyes and to mangle it all into the available space. I made the holes big enough for the dome of the LEDs to fit through but small enough to prevent the rest of the LED housing from pushing through.


And here it is outside our house (flashing on the opened door frame), waiting to welcome the trick-or-treaters :)



Monday, August 10, 2009

Home cooked PCB etching - part 1

I saw this excellent Instructables on easy PCB etching and have been itching to give it a try ever since. I popped into the local Radioshack to pick up the bits, but was dissapointed that they had neither the ferric chloride solution nor the copper boards. So, when we were up in Santa Rosa for the mini Maker's Fair (see Lin's blogpost for more on that) I ran into the Radioshack up there and was lucky (they'd only just restocked them). Tonight, after the battle of the bed-times, I thought I'd give it a test run. For a proper run, I'm going to have to decide on a board to make, get some transfer paper and print out the design at work (no laser printer at home).

The instructable mentioned that a sharpie should be enough to mask the board, so I drew out a test pattern:

Imaginative, eh? I guess I could have gone computer programing 101 and used "Hello World!" instead.

So, next step was to add ferric chloride solution to a sponge and get scrubbing. The only plastic gloves we've got in the house are 'small' so I figured I'd risk it and just try keeping my fingers out of the way as much as possible. I used a dollar store, sponge on a stick, dabbed on a small amount of ferric chloride solution and got scrubbing.

About 5 minutes later, nothing had happened. A bit of an anti-climax from the promised '"1-minute etch" but I persevered for a little while longer and added a bit more solution to the sponge. I couldn't tell if the black liquid that was forming was to do with the etching process, or if it was just me scrubbing off the sharpie marks...

Another 5 mins of scrubbing and a few more dabs of solution yielded a glimmer of hope:

You can clearly see some of the copper being cleared from the top of the board. A few more minutes and most of the board was clear. Being impatient, I stopped there and used a "Mr Clean magic eraser" to clean off the remaining sharpie marks (no nail polish remover in our house, but plenty of need for powerful grime removal ;) ).



Sweet! It works! Time to create something more functional!

Wednesday, July 8, 2009

Solar powered fairy lights

  
Yes, I'm going through a solar powered phase right now. I'll have used up the parts I bought from allelectronics.com soon enough & will have to move onto pastures new.

My lovely lady suggested it'd be nice to have some twinkling fairy lights in the kitchen; ideally, ones that didn't need to be plugged in to the mains. The simplest solution would have been to use a battery pack, but our kitchen gets a fair bit of light &, like I said, I'm in a solar powered gadgetry phase right now...

My ebay habit has brought me some colour changing LEDs (before I knew exactly what they did). These look like normal LEDs (two leads) but cycle through a few colours over the course of 15 seconds or so. I figured these would be perfect for the project, so I dug out 4 working ones (using the LED tester I posted about previously).

There are very few components for this (if you count the solar-panel/charger as a single component): 1 solar charging circuit, 4 colour changing LEDs, an Altoids tin, some wire and I used a couple of neodymium magnets to secure the tin onto the curtain rail in our kitchen.

The first thing to do is to cut the LED leads from the solar-charging circuit, this is where we'll attach the wires for our own lights. I also cut down the plastic 'pins' which hold the circuit board in place; this was to make the assembly fit nicer in the tin (and as an excuse for me to try out some new cutting disks for the Proxxon).

I then cut two strands of wire (about 1 1/2' each of red and black), marked where I wanted to place the LEDs/lights on the wires and striped away the insulation around these points. I ended up melting the insulation away with a soldering iron and then using a knife to scrape off the excess plastic. There must be a much better way of doing it.

Soldering the LEDs onto the wires was a little awkward, especially since I cut the LED leads down to about 1/3 cm to keep them close the the wires. I'm glad I decided to only put on 4 for this prototype! Hmmm... thinking about it now, I should have left the leads on and bent them around the other wires to hold them in place whilst soldering them, doh!

After soldering the LEDs, I drilled a couple of small holes in the Altoids tin, threaded in the two wires and soldered them onto the solar charging unit.
Slide everything into place and there we go:


My better half has been making lots of playdough for some lovely projects (see: Dinosaur Island and playdough rain table) as a result, we've used up a lot of food colouring. It turns out the bottles make quite good LED diffusers. The picture below shows the Fairy Lights in front of our kitchen window. I used two magnets to make the tin secure (the magnets are on the inside of the tin). I also ended up taking the lid off the tin and securing the solar panels in-place with a couple of elastic bands.


Saturday, July 4, 2009

Personal empowerment through skill acquisition (or how I fixed a Vtech Tote 'n Go)

Phew, what a poncy title! Well, that's me through and through :) But what I wanted to post about was how empowering learning something pretty simple like soldering has been for me.

The kids have been playing with various incarnations of Vtech laptops (ones that play 'learning' games to do with letters and numbers). Their first laptop, the Vtech Tote 'n Go, broke about 6 months ago, the speaker stopped working as did the mouse button. Normally, that'd mean landfill for this big bit of plastic, but, having learned a little bit of electronics, I took it apart to see if I could figure out what was wrong.

It turns out that the speaker wires had broken off and the small push button inside the mouse had broken completely. I got the speaker wire soldered back in place the same day, but the button fix had to wait a while. I was tempted to hack together some Frankenstein creation using the huge push buttons I bought ages ago, but decided against it (I'm sure the kids would have loved it though).

I recently found allelectronics.com (see the solar power upgrade to the fireflies) and, as part of the initial order, I bought some small push buttons which were exact matches for the one in the kids laptop. So I took a second stab at fixing it. I couldn't successfully de-solder the original button, so I just clipped it off, trimmed the leads of the replacement and soldered it in place.

All very simple stuff. I left the laptop out somewhere I knew the kids would find it and the next morning I hear our youngest waking up our oldest by crying "Carys! Carys! Come see! Come see! The monkey laptop! It's working!". It was lovely.

The shocking part of this is that our friends have the same laptop and it's mouse button has stopped working as well. I'll fix that one too, but it must mean that loads of these things become landfill just because a single button breaks...

LED tester


I have to be honest, I've not been very er... meticulous when it comes to keeping my LEDs in check. Let's be frank, I have a big mess of them and I've no idea which ones work or what colour they are. I'm about to start on a solar powered fairy lights project and realised I'd be spending a lot of time working out which LEDs were the ones I wanted (hence the subject of this post).

To date, I've been using a torn down dollar store hand fan for testing; I'll take a picture to show you what I mean:

It's not the easiest to use, but it outputs ~3V, has a switch and two leads (not obvious which one is positive and which one is ground though since they're both red). I ended up getting frustrated whilst holding the ends of the wires onto the LEDs and then switching over wondering if the batteries were dead, the LED was dead or if I was just crap at getting a decent connection between the leads.

Anyway, what all this blathering is getting to is that I wanted something simpler and more reliable to use. You know, something that doesn't make me want to throw it against the wall in frustration... I'd been messing with 8 pin IC sockets and perf board for other projects and realised that they are perfect for this as well. So I got together the old battery pack from the JarOFireflies prototype (which is why it has a magnet still glued on top), a small bit of perfboard, an 8 pin IC socket and 4, 330 ohm, resistors.

I soldered the resistors and socket onto the board at the same time.

I used the wires from the last resistor to solder all the connections on each side together forming two rails (positive and ground):

Then I soldered in the wires from the battery pack, connecting one to each rail, and voila!

The nice thing about this is that it's easy to check a single led without messing much with it's leads (since there's 4 holes a side, there's plenty of room) and it'll also accommodate, up to, 4 LEDs at a time:


This took about 20 mins to put together including frequent interruptions from the kids wondering what I was doing by myself in the garage.

UPDATE (2009-09-19): The resistor set-up I created is obviously crazy, I'm not sure what I was thinking (or not) at this point... The resistors should be separating pins 1 - 4 from the positive rail.