Saturday, August 22, 2009
Bicycle Speedometer Project
At it's core, it's just a simple reed switch hooked up to a PIC microcontroller's CCP module (in capture mode) which measures the period of the turning of the wheel. Based on the period data, the microcontroller then calculates the speed and displays the information to the user on an LCD screen. Now, to dive in deeper...
This project can, of course, remain as simple as a mere speed measuring device or can be expanded into a full bicycle computer which maintains trip logs (time, distance, speed, keeping track of rest breaks), control headlights based on ambient light and so on.
The main speed measuring module consists of a reed switch mounted on one of the front forks. A strong magnet shall be placed on one (or more) of the spokes. Every time the wheel turns, the magnet will pass the reed switch and close the circuit, sending a signal to the microcontroller. The microcontroller is then interrupted by the event and the CCP module then measures the period. To compute the speed of the bicycle, only the circumference/diameter of the wheel and the period must be known. Although only one magnet is required, more can be placed to allow for greater accuracy. On the PIC's side, an appropriate external crystal shall be used with the CCP's timer to allow for millisecond timing. With the appropriate crystal, the CCP can then measure the period (in milliseconds) of the wheel to produce very accurate speed readings. Readings can be presented to the user every 1 second, for example. The LCD can be of HD44780 type or this or this or one of the graphic LCDs at Futurlec. The LCD should be small and readable yet consume as little power as possible. The microcontroller itself will be in sleep mode most of the time to conserve power.
A real time clock and SD card (via SPI interface) can also be added to the project to allow for data logging and to add a simple real time clock. The RTC will maintain time via a "backup battery" and the SD card would be written to every now and then.
The entire computer could be powered by batteries. But since the computer consumes less than a few mA at most, a solar panel is also possible. Or it would also be possible to use the energy generated by the bicycle and store it in capacitors.
As for the core of the computer, any PIC would do for such a relatively computationally non-intensive job. However, I was thinking of using the dsPIC33FJ128GP802 :)
Saturday, April 11, 2009
DIY IPOD Battery Pack
So my IPOD Nano 1st G internal battery is dying. I can barely squeeze out a few minutes of play time using the normal Apple firmware. IPOD Linux and Rockbox are awesome; by setting the backlight brightness to a minimum, I can get a whole lot more playtime. One option is to buy a battery and installation kit (they’re pretty inexpensive). However, this method requires you to open up your IPOD (which is really not that big of a deal), but there must be a simpler way of getting the job done – using components you can find around the house.
What I’m talking about is an external power supply/battery pack that can fit onto any IPOD (through the USB cable) - http://www.ladyada.net/make/mintyboost/
But we can make one ourselves – a more versatile one.
The IPOD cable consists of one end that plugs into the device and the other end is a standard USB male connector. The USB connector consists of 4 pins - V+, GND, D+, D-. To supply power to the IPOD, we need to supply exactly 5 volts through the V+/GND pins. The D+ and D- should be tied to V+ via 100k resistors (I think – more on this later). And there you have it – your own power ipod power supply.
The actual circuit, however, can get a bit complicated. What regulator do we chose? The design I’m thinking of will be able to be powered from as little as 2 AA batteries to the 12 V output from your car. We need a regulator that can accept this high range of voltages. Obviously it needs to be a boost/buck (step up/step down) regulator. These tend to get a bit annoying as we need external capacitors and solenoids for the circuit. Take a look at the mintyboost above for inspiration.
Oh, and it would be cool to have it small enough so all of it fits on the back of an IPOD Nano 1st G.
Just a thought.
Thursday, March 5, 2009
DIY Automatic Precision Wire Cutter for Prototyping – Part 2
In the previous post, we examined a possible set of features and design goals for such a device. However, the feature set and design goals are difficult to implement. So here’s idea #2. The design is greatly simplified and has less feature. However, it should be much simpler to make.
The device will consist of a set of wire feed rollers, a wire cutter and a wire insulation stripper head. Since it is difficult to design a device that will fully remove the insulation off of the end of the wire, this design will not incorporate such a feature. Instead, this design will use the insulation stripper head to pinch (effectively cut) the insulation near the end where it should be stripped off. After it has pinched both sides, the cutting head will cut the wire. The wire will fall out and is almost ready for use. However, the insulation has not been stripped from the end; it has only been pinched. It is now very easy to remove the insulation by hand with your fingernail since it has already been cut. Here is a diagram of the design:
How it works:
- Wire is fed into the wire feed rollers. The wire then goes into the thin tube in the middle which aligns the wire properly.
- The wire is further rolled out until it reaches the insulation pinching head. At this point, a little more wire is pushed out (about 5 mm) so that the insulation can later be stripped off.
- The cutting head then does its job by pinching the insulation so it can be pulled off easily by your fingernail.
- More wire is fed. The amount that is fed is equal to the desired length of the wire.
- Once the desired length of wire is fed, the insulation pinching head once again pinches the wire.
- Now more wire is pushed so it can advance to the cutting head. The cutting head finally cuts the wire (end product) which then drops out of the machine.
This design is a lot simpler because it requires a lot less parts. Stepper motors and motor drivers can be found anywhere. The insulation pinching head can be acquired by dismantling a hand-operated wire cutter which can be found anywhere as well. The cutting head can be made out of anything – even cheap wire cutter pliers if desired.
The whole device can be controlled by direct connection to a computer or by a PIC microcontroller.
DIY Automatic Precision Wire Cutter for Prototyping - Part 1
One of the most annoying things while prototyping using solderless breadboards, prototyping boards, Veroboards and so on is cutting your wires at just the right length to make a perfectly straight connection. Sometimes, you may need a small piece of wire that will connect points 2, 3 or 4 holes across. If you have many of these, the wire cutting process itself will consume most of your time.
Well how about a DIY computer-controlled machine that will cut wire, strip it and bend the ends at a 90 degree angle for you at just the right length? Pretty neat, huh?
Design goals:
- Inexpensive to build.
- Easy to build.
- Fast to build.
- Easy to set up and use.
- Compact and portable.
- Can either be controlled by a microcontroller + LCD + keypad user interface for stand-alone use or can be controlled by direct connection to a computer.
Functions:
- User provides a continuous supply of wire to the machine.
- User then selects the length of the wire and length of the contacts.
- Machine cuts length of wire (= desired length + contacts length).
- Machine then strips the ends of wire of insulation to expose the copper. This is done with respect to the desired contact length chosen by the user.
Already the design of the machine becomes quite complex. More details to come in the next post.
Tuesday, February 24, 2009
Build Your Own Clock
- A PIC microcontroller (16F886 seems like a good choice; a 12F683 can also be used).
- A 32.768 kHz crystal for timing (can be used as the primary clock source as well as timer clock source for the PIC).
- A display. For this purpose, an LED Matrix display or LED 7 segment display can be used. A very low power static LCD can also be used if low power consumption is part of the design goal.
- Shift registers can be used to drive the LED displays.
- Optionally, a system to synchronize to local low-frequency radio time signals can be added.
- A light level sensor can be used to automatically adjust LED brightness based on ambient light levels. Should be dim during the night and bright during the day. (Possible use for a photoresistor hooked up to the ADC on the PIC?)
- Include a user-programmable alarm.
- Include a calendar.