Category Archives: Microcontrollers

Smart Battery Charger

This unit was constructed in the shell of a Radio Shack battery charger. The original unit charged only one type of battery at a time and only in pairs. This unit allows for mix and match for AAA, AA, C, and D cells. Each battery is individually monitored and charged. An LED for each one flashes to show the current charging condition as follows….[list:68e9b49a6d]Dim with bright flash: No battery detected
Solid on: Battery charging
Blinking on: Battery charged[/list:u:68e9b49a6d]
When a battery is first inserted, a small charge is pulsed to it. In between the pulses, the battery is tested for voltage. This prevents the unit from attempting to charge shorted or really dead batteries. If and when a voltage is detected, the unit begins normal charging.


Copyright 2006 [url=]Luhan Monat[/url]

Temperature Controller (AVR + DS1621)

Wine doesn’t like subzero temperatures, and during wintertime, my “winecellar” got pretty cold.
There was an electric heating element, but the thermostat was broken, so it was either full burn or nothing.

That’s how the temperature monitor/controller came to be.
It was an obvious task for a small processor and I’ve always wanted to test the Dallas temperature sensors.

So, I designed this little device which could monitor the temperature and control the heater.

It’s based on an AT90S2313 and a Dallas DS1621 Digital Thermometer. The temperature is displayed on a dual 7-segment display, and two buttons are used for setting parameters. A high current relay switches the heating element.

I used an AVR 2313 as it just the right number of pins for this task. Also, it’s programmable in C, which makes things easier. An alternative would be the 1200, but I’ve got some bad experience with that.
A 4 MHz ceramic resonator is used for clocking the 2313.

The displays are common cathode displays. The segments of both displays are tied together and multiplexing is handled in software. Note that the decimal point segment also are used. More detail about this later.

The power supply is straight forward. A single or double tap 9 V transformer with a rectifier circuit and a 5V voltage regulator. The rectified input to the regulator is also supplied as a drive voltage to the relay.

The Dallas DS1621 chip interfaces to the 2313 using a I2C interface. This is a 2 wire bidirectional bus with a speed up to 400 kbps.
Up to 8 DS1621 devices can be connected on the same I2C bus, but in this case there’s only one device, so the address selector pins on the DS1621 is pulled low, giving it address 0 (well, 0x90 actually).
Actually, the DS1621 has a thermostat output, which can be programmed to a certain temperature, but it’s not used in this application.

The relay needs about 40-50 mA and is driven by a standard NPN transistor.

The two buttons are used to set the temperature where the relay should kick in. As the code is now, the relay will always be ON when the measured temperature < set temperature, but this could be changed (if you would want to control an air-condition f.i.)

Normally, the display show the measured temperature. The left decimal point will toggle on/off to show that the system is “alive”. The right decimal point show the state of the relay, on or off.
A short press on either the UP or DOWN button, will display the set temperature for about 1 second. If the key is held down, the set temperature will be increased or decreased respectively.
Pressing both keys at the same time gives access to two parameters :
The first is the hysteresis (indicated by the middle segment in the left display being lit, the right display show the parameter value), which determines the relay switch points. For instance, if the hysteresis is set to 2, and the set temperature to 21 degrees, the relay will go ON at 19 degrees, and OFF at 23 degrees. This is to avoid a situation with an oscillating relay.
The second parameter is the display duty-cyle (indicated by the bottom segment in the left display being lit, the right display show the parameter value). This controls the display multiplexing, and effectively determines the display brightness.
Both these settings are stored and fetched from the in the EEPROM.

A fun little construction and a good way to learn about the DS1621.

Inside of the box

[url=]View schematics[/url]
[url=]Download C-code[/url]

Copyright 2006 [url=]Jesper Hansen[/url]

AccelR8: a device for measuring acceleration

This is a fun project. Unfortunately, it takes some time to develop the code, so this is a work in progress and here i’ll just present the project so far.

Basically the AccelR8 is a device for measuring acceleration. It can measure +/- 2 g.
As it contains a microprocessor, it an also measure time.

This opens up some interesting possibilities. If we have the acceleration and the time, we can find speed (V), as V = a * t.

Also, we can find distance (D) as D = 0.5 * a * t * t.

If we now the mass of the object we are moving, we can also find the force (F) applied, as F = m * a.

And finally, from this we can find the power (P) from P = F * V.

So, after this Physics 101 refresher, what does all this mean ?

It means that you can just enter the weight of your car into the AccelR8, find a straight and level piece of road, go Bleifuss on the accelerator, and AcceR8 will tell you :

Acceleration 0-100 km/t (0-60 mph),
Braking distance 100-0 (60-0), and
Maximum Horsepower,

as well as a number of other interesting things. If you’re not careful enough, a cop may tell you a number of unrelated uninteresting things !

The operation and mode is controlled by a single pushbutton on the front. Calibration and value settings are made by simply tilting the device and using earth-gravity to scroll the values.

The AcceR8 in it’s cage.

AccelR8 innards. Click to see large image.

The schematic show that the AccelR8 only uses 3 IC’s. An AVR 8515 microcontroller do the calculation work and controls the other circuits. An MAX603 controls voltage and power-on/power-off. And the chip that makes it all possible, the ADXL202 from Analog Devices measures the acceleration.

This chip is a small wonder. It uses a tiny micromachined polysilicon structure on the silicon wafer. The structure is part of a capacitor, so deflection of the structure (by acceleration) can be measured.
The ADXL202 can measure acceleration in two axes, and if you have a Microsoft Freestyle Gamepad, you already have an ADXL202 !

In this case, we only use one of the axes, and the ADXL202 outputs this data as a variable duty-cycle squarewave. The 8515 calculates the acceleration by measuring the pulsewidth/period relationship. The acceleration is then used in further calculations, and the resulting data is show on the display.

Schematic is available for download below. Unfortunatly the source code is not available yet.

Copyright 2006 [url=]Jesper Hansen[/url]

Ericsson Cell Phone Display GA628

Based on a WWW publication I [url=]found[/url], I designed a software written in standard C for the MSP430 family. It can easily be modified for different micros.

The GA628 display provides a 12 character alphanumeric display , some icons in the second line and power consumption of some 100 uA. It can easily be connected to the hardware, simply by soldering some wires. The only disadvantage is , it needs a 3.3V power supply and something around 5.6V. However, this code and the MSP430 provides a clock for a simple charge pump, realized with 3 diodes and 3 capacitors.

One may [url=]download the driver for the display here[/url]. (3K zipped)

[b:9c07629195]Ericsson GA628 LCD display information[/b:9c07629195]
I2c device address: 0x74h, 0x75h
Lcd chip: PCF2103

1 = Vlcd (+5.6V)
2 = Gnd
3 = Vlogic (+2.8V)
4 = Vlogic (POR)
5 = Sdata (i2c)
6 = Sclk (i2c)

[b:9c07629195]Charge pump schematic[/b:9c07629195]

Copyright 2006 [url=]Robert Tyrakowski[/url]

Nokia 7650 LCD Controller

Despite nobody seems to own the appropriate documentation, it is possible to use the big cheap color LCD displays of the Nokia series 60 cell phones for home brew projects. I don’t even have the docs and it was a rough and painful way, but now it works.

[b:4954943b50]A brief overview about the controller solution[/b:4954943b50]

The Nokia 7650 LCD has a host interface which consists of an 8 bit bidirectional data bus and some control pins. Due to the unknown on-board controller instructions set, an image for the display is put together in the RAM area of an external controller (LPC2106, an ARM7TDMI-S). After the new image has been completed in RAM, a high speed data transfer from the LPC2106 image RAM to the display takes place. It lasts about 23ms.

Each pixel can be controlled by 12 bit to get a specific color. Each pixel of the existing 36608 pixel can be controlled individually. There is no color table, but there is a direct relation between a 12 bit value and a specific color.

The current controller SW supports upright and landscape character display. The characters can optional be displayed in transparent mode or with an own background color. Also characters can be displayed in a fixed raster or optionally in a “floating”raster.

There is a character set generator SW by Fabian Thiele. The font format of the LCD7650 controller is compatible to this tool. Each character can consist of an own color. Multi-color for single character (each pixel a different color) is not supported.

The 7650 controller (LPC2106) offers optional cursor support.

Pictures can be displayed if they are delivered in an appropriate format. There is a converter which translates a picture in a fitting format (C-style), which can be integrated in the SW or transfered to the controller via the external connection.

The connection to the host can either be RS232, RS232-TTL, I2C or SPI. Both last mentioned connections are not implemented yet.

There is an own instruction set for communication between the LCD-Controller and the host. Several graphic functions (draw lines, draw rectangular, circles etc) are already implemented. A PC tool is available which allows to test all available functions via a RS232 connection.

For home brew applications often some keys are needed. The current SW supports the existing rocker as well as 8 additional keys.


[i:4954943b50]Display:[/i:4954943b50] 176 * 208 pixel , 4096 colors (12 bit)
[i:4954943b50]Connectivity:[/i:4954943b50] RS232 , RS232(TTL), I2C,SPI
[i:4954943b50]Keys, Rocker:[/i:4954943b50] LCD rocker is supported, as well as additional keys
[i:4954943b50]Character set:[/i:4954943b50] 3 fixed, 1 loadable, [url=]GLCD FontCreater2[/url] compatible
[i:4954943b50]Direction:[/i:4954943b50] Upright and landscape (rocker right hand)
[i:4954943b50]Character:[/i:4954943b50] fixed size, float size, transparent w/o background color, w/ back ground color
[i:4954943b50]Cursor:[/i:4954943b50] Optional cursor support.
[i:4954943b50]Graphic:[/i:4954943b50] lines, rectangular, circles , round corners, fill
[i:4954943b50]Picture:[/i:4954943b50] Tool available for converting BMP to RGB (C style) ***
[i:4954943b50]Update rate:[/i:4954943b50] around 23 ms , independent on instruction
[i:4954943b50]Test tool:[/i:4954943b50] PC (Visual Basic) test tool PC7650 available
[i:4954943b50]ISP Tool:[/i:4954943b50] ISP tool by Philips
[i:4954943b50]Protocol:[/i:4954943b50] Protocol documentation available soon
[i:4954943b50]Voltage:[/i:4954943b50] 5V, 60 mA ( max 110 mA , depending on back light intensity)


[url=]Schematics of the Controller[/url]

[b:4954943b50]Source code[/b:4954943b50]

Due to a lot of people asked me for information about my Nokia7650 controller, I’m now sharing the source code for non commercial user. Read the information about Copyright and support in the main source!
[url=]Download the sources here[/url]


[url=]Tool Bmp2RGB[/url]
[url=]Download Philips ISP tool[/url]
[url=]GLCD FontCreator2 by Fabian Thiele[/url]

Copyright 2006 [url=]Robert Tyrakowski[/url]