Archive for the ‘Tutorials’ Category
Saturday, March 7th, 2009 |
With all the nice hacks on digital picture frames scattered around the web, I decided to put them all in one place for reference. Due thanks to all the hackers out there who put their work out for everyone to see. It’s the joy in reverse engineering. For some of the hacks I’ve included a compressed file with the code and webpage archived in case the original site goes down. If you are the author an would not like it, please let me know.
Please read : If you would like to be notified of new frames being hacked, leave a comment below and check the “subscribe to comments” box.
PHILIPS Picture Frames
[v]incent was able to display his images directly to the frame by writing a little script which prepends a binary header to the JPEG file. There is a detailed writeup on how he reverse engineered the picture frame format.
Detailed info:
CEIVA Picture Frames
The CEIVA runs on a Cirrus Logic Maverick(EP7212) controller. It’s based on a ARM720T core with 2Mb Flash and 4Mb DRAM.
Initial hack done by [c]olin. The frame runs on Linux. Necessary patches and images are provided. [b]rad keeps a worklog here
New code can be loaded via a serial port on the PCB through a simple level converter.
Detailed info:
KeyChain Displays
[j]eroen from Spritesmods maintains a wiki of compatible keychain displays with his firmware hack. He and a couple of guys regularly update it with new displays. Most of the displays use the SITRONIX ST2205U controller in them. I tried my hand in doing the same with the Hannah Montana Vu-Me photo frame. I got close, but bricked it in the end.
Their code is maintained at Google code
Detailed info:
- Models:
- TomTec
- Coby DP-151SX/DPKEY
- HK unbranded
- Keypix
- Dealxtreme SKU5218
- Innovage
- Dig-291
- Innovalley
- Webpage
- Wiki
- Google code
DIGITAL SPECTRUM MemoryFrame
The MemoryFrames run on WindowsCE5. [r]etoor from mozy.org managed to crash the frame using a keyboard, mouse and following a sequence. The frame runs on an ARM920T – a 32bit Arm9 processor. The following is an excerpt from his “YouTube’s more info…” link:
…”Basically you need both the mouse and keyboard plugged in, scroll down past the “Settings” option, scroll back up, and click the word “Settings” with your mouse. There is no enter key on the keyboard so you have to click the mouse….”
Detailed info:
SAMSUNG SPF-83v Frames
The frame parses feeds and regular html pages for images and displays them. You can use the frame’s i-net-functions to serve it data.
[t]obe from Infolexikon uses PHP to gather data and writes it all to an image using gd. These images are then pushed to the frame at regular intervals.
Detailed info:
JUICEBOX Digital Frames
[j]oevennix managed to rip out the LCD from a Juicebox and enclose it in his own custom frame. He didn’t have the mp3 kit at that time( although you can get it online), so he soldered a SD card slot into the cartridge connector. His webpage is down. The following is an archive of his work.
Detailed info:
If you find this interesting or have some new ideas or links on frames, please post in the comments. Don’t forget to Subscribe [email]for more followups and hacks. To get updates on this page, subscribe to the comments below.
Posted in Hackable Toys, Tutorials, hacks | 11 Comments »
Saturday, February 14th, 2009 |
As promised, after taking apart the ATV-360 Spy Video here, this is a follow-up on taking apart the Head Mounted Display[HUD]. The HUD has some very interesting DIY parts and ideas which you can try out. Maybe a cool wearable. The details on all the parts used are at the end of the post and comments are open for discussion.
The HUD consists of a frame which sits in the same way as you would wear a pair of spectacles. On the right side, a case is attached which holds all the necessary electronics and optics. The HUD receives video signals from the remote which houses the camera receiver.
1. First for a few views. Click on the views for a larger image.


2. So that you know how it looks, I setup two scenes. One with a PostIt note saying “HI” and the other a Rubik’s cube. The LCD is monocohrome however, so the image you will see is not color.
- The one with the PostIt note


- The one with the Rubiks cube


3. Opening is not that easy as there are no screws to take apart the top cover which says “Spy Gear”. The cover is glued to the case using glue. Taking a clue from Jake to avoid inserting the screwdriver on the side the “cable does not come out”, I managed to take it apart. Pry the side where the black cable comes out. The other side has the LCD connector, you might damage it if ou pry that side. It’s tough at first, but once you get one side, it gets easier.

4. Once the cover is removed, the PCB becomes visible. The main controller chip is a Kopin KCD-A300-QB. All the other parts are support components for the chip. There is a small potentiometer in one corner which allows you to change camera gain. You can see the display change in brightness when you change it. Try adjusting it, there is no harm in doing so as it can easily be bough back to it’s previous value by looking at the screen.



5. Remove the two screws keeping the PCB in place. Also it’s time to remove the LCD connector. To remove it, pull the black tab out a bit as in the pic.
The connector will slip out easily with a slight tug. The connector is pretty rugged. I have already plugged it in/out a few times.


6.The LCD connector is glued on to the casing. Remember to break it free before going ahead.

6: Four more screws need to be taken out to remove the eyepiece. Use a pair of pliers to do this.

7.Before I forget, the PCB has a high output smd LED behind it as below:


8. Prying out gives you the lens casing. It’s pretty well made, with the LCD nicely sitting in it’s place. It was designed so that the lens was at a fixed distance from the LCD.




9.Going further, pry the top half with a flat head screwdriver. There are four tiny rods which keep it inline. This part should come out easily.

9.Now for the LCD. The LCD is in a tiny casing which sits in a grooved box. There is a slight amount of glue on one end as in the image. With a flat head screwdriver, as shown, just give a tiny nudge and it should come free.



10. The LCD in all it’s glory!


11. The following views show the three pieces of the lens casing. Note that the part at the extreme right of each image has a diffused screen to spread light from the SMD LED.



12. This was as far as I could go. The eyepiece is glued together. Trying to take it apart would mean risk in breaking the lens.
Parts and Notes:
Main controller chip :: Kopin KCD-A300-QB
Documents :: kopin_kcd-a300-qb_dsiplay_driver
Notes :: This is the driver chip for the 300M LV monochrome display. It is designed to accept a standard monochrome video signal (525 or 625 lines), and convert it for the display. Unfortunately its a monochrome driver and not a color one.
LCD Display :: Kopin 300MLV CyberDisplay
Documents :: kopin_cyberdisplay_300m_lv_feature_sheet
Notes :: This is the LCD Display with the connector. The feature sheet shows a frameless one, but I’m unable to find the document with the framed one.
If you find this interesting or have some new ideas or links, please post it in the comments. Thanks for reading and don’t forget to Subscribe [email] for more followups and hacks.
Posted in Hackable Toys, Tutorials, hacks | 16 Comments »
Tuesday, February 10th, 2009 |
Things with LCDs are very interesting. I found a Hannah Montana Digital Photocube on sale and decided to look what’s inside it. Good for a day of hacking :)
First a description:
- Storage capacity: 8 M bit (Up to 70 photos) Resolution: 128×128 dpi
- Display: 1.5-inch color LCD
- Supported File Format: JPG (JPEG),BMP, GIF, PNG, & TIF
- Power: 2 xAAA batteries (not included)
- USB Ports: Mini-USB 1.1 interface
Searching around the net produced a lot of work done by Sprite. He and a couple of guys maintain a wiki containg information about hacked lcd keychains. Most of the keychains that have been hacked contain a ST2205U Microcontroller. With this information I proceeded ripping apart my photocube. This was what was inside:





A 1Mb A29L800( datasheet ) flash chip and a micrcontroller hidden behind a big black blob along with the LCD, buttons, USB port and an on-off switch. With some reading on Sprite’s blog and modifyng his script a little, I was able to verify that the microcontroller was indeed a ST2205U. If you browse through main.c, a function is_photoframe checks if the controller is a ST2205U. So I inserted a printf(“Response : %s\n”,buff) to verify if the chip gave back the correct string, which it did.
/*
Checks if the device is a photo frame by reading the first 512 bytes and
comparing against the known string that's there
*/
int is_photoframe(int f) {
int y,res;
char id[]="SITRONIX CORP.";
char *buff;
buff=malloc_aligned(0x200);
lseek(f,0x0,SEEK_SET);
y=read(f,buff,0x200);
buff[15]=0;
printf("Response : %s\n",buff);
// fprintf(stderr,"ID=%s\n",buff);
res=strcmp(buff,id)==0?1:0;
free_aligned(buff,0x200);
return res;
}
I’ll try documenting my steps going further. It’s in Linux( RedHat ) since I work on it, and you could do the same using a linux live cd.
1. Unpack Sprite’s hack from here. You will need to install libgd if you don’t have it. As root install gd-devel. Please read the README file in the unpacked directory. It’s written for a reason.
yum install gd-devel
2. Then as a user type “make” in the unpacked directory. This will compile the hack to give you the “phack” binary.

3. Now connect the photocube and turn it on. You will see “USB Connect” displayed on the screen. Open a terminal on your linux machine and type
dmesg | tail
This will give you any hardware information that occurred last. You will see the following:

If you see something like:
4096 512-byte hdwr sectors (2 MB)
then your close. Also note where your cube is mounted so you can access it. If you look at the pic above it says “Attached scsi removable disk sdg”, which means that the cube is mounted at /dev/sdg
4. Now to hack the firmware.
WARNING : Anything you do after this is at your own risk.
Type the following as root in your terminal, using the mount point which you got from step 3.
./hackfw.sh /dev/sdg
You will see the following as checks are made and eventually an error:

Sprite’s script makes a backup of the firmware and an image of the memory. It however says that “The hack won’t work for my Firmware.” When I looked into the script, it looks if my cube’s firmware is same as Sprite’s when he hacked his keychain, which is an entirely different product.
dd if=fwimage.bin bs=256 skip=58 count=2 of=fwbit 2>/dev/null
#check for all FFs Md5sum may not be _the_ tool for that, but it works OK.
if ! md5sum fwbit | grep -q de03fe65a6765caa8c91343acc62cffc; then
echo "No room at the location we want to place the hack!"
echo "This specific hack won't work for this particular firmware, I'm sorry."
exit 1;
fi
I did not have anything to loose, so I commented it out to bypass the check. Just put a “#” to comment out code.
5. I ran the script again (run as root), this time it went through the whole flashing process, till I rebooted

6. The script ends with “No Photoframe found here”. Turn off, Disconnect, Turn On and the Connect the photoframe. Get the mount point as in step 3. Type the following as root.

You should see the following on the LCD

The script allows a maximum of 10 characters. Another example

I was however unsuccessful in getting PNGs or JPEGs uploaded to the device. That’s when I bricked my cube trying different memory addresses. It doesn’t even turn on now. I’ll update when I get my hands on another one. If you have any questions or comments, you could enter them below. Thanks for reading and don’t forget to Subscribe for more followups and hacks.
Posted in Hackable Toys, Tutorials, hacks | 9 Comments »
Sunday, February 1st, 2009 |
I finally took apart the Spy Video which I got for a very good deal. I wanted to see if it would serve as a good platform for a robot and if the drive system could be upgraded. The most difficult part was taking apart the wheel hubs. The interesting part in the hubs design is that a better motor can be attached to it. The following sequence shows me taking the vehicle apart. Might come in handy for hardware hackers out there.
1. Various views of the vehicle.




2. Remove all the screws from the bottom of the vehicle, including the tracks.


3.Remove the top shell slowly. Don’t pull on it. You will need to disconnect the camera, antenna and mic headers to get it free.


4. Once the top shell is free, the circuit board and the drive system is visible. There is a bank of FETs for the motors. The board is very well labeled.


5. To take apart the drive system, loosen the screws around the orange box. Then unscrew the black tab keeping the wires from the orange box secure.





6.Taking apart the wheel hub is a chore, but possible with pliers, a small glass jar, some flame and some strength.First, remove the stopper from the shaft. Use pliers and strength:

Remove the large gear and everything between the gear and the stopper. Now again using pliers, remove the torque check gear:


Remove all the stuff after that including the orange cap with the three screws. Once the orange cap is removed, the black cover on the other end of the wheel can be removed:


Now for the interesting part. The wheel hub is dead set into the shaft and we need to remove it. Make sure you have a small jar, like below, ready. Choose one such that it’s mouth is small enough only for the shaft to go in. Ignore the gears on the shaft in the picture. You should be having just a blank shaft with the black hub and orange cap on.


Make sure you have the orange cap on. Now heat the shaft with a flame for around 30 seconds. This is just to soften the hub’s hold on the shaft. Holding it over the flame too long is going to melt the plastic.

Now while the shaft is still hot, place the shaft as shown below and hammer the other end down.

The shaft should come out after a few bangs. The wheel is now disassembled:



7. Why all this? I can now use a hub adapter and attach the ATV’s stock hub to a better motor.
The following hub adapter is from Lynxmotion. I will need to drill new holes to match the adapter.


If you are interested, check out your local Target store or you could try Amazon:
Thanks for looking. Any questions, ask in the comments.
Posted in Hackable Toys, Robots, Tutorials, hacks | 4 Comments »
Monday, January 12th, 2009 |
This note illustrates how to decode or parse incoming serial data with an example. Transmitting one byte serially to a microcontroller is simple.The easiest way to do this is to interrupt the controller when a byte arrives on the receive pin. There is no need to parse or separate data as whatever comes in, is assigned to a variable. But what if there is more than one byte that needs to be received.How would you go about separating all the bytes and put them into their respective variables?
The example illustrated here is to parse direction,steering angle and speed sent from a PC to a microcontroller, in this case a Microchip PIC16F876A. Parsing in this example is based on the idea of a state machine. If you need to know more about state machines, the following link may be helpful:
Microchip forums : Most efficient way to “decode” serial data?
Most of the code used here is based on feature article by Glen Worstell on a “Ham Radio Repeater Locator” using a Garmin GPSMAP 295.
Links : Here
code : Here (ftp).
In this example, my PC transmits a serial string “$122133200″ where :
$ : Start of String(SOS)
122: Direction(Note 1)
133: Steering Angle
200: Speed
In my microcontroller the incoming string is compared byte by byte with a parser string “$dddtttsss” using a state machine where :
$ : Start of String(SOS)
ddd: Direction
ttt: Steering Angle
sss: Speed
The State Machine:

State 0: The state machine does nothing until a “$” or Start of String(SOS) is received.
State 1: “$” received.If not goto State 0.
State 2: The parser knows that the next(second) byte coming in has to be a Direction parameter, because of the “d” in the parser string If a number comes in, it is stored. If anyhing anything other than a number is received, it is discarded and the machine returns to State 0. This continues for 2 more bytes.
State 3: The fifth byte is the steering angle, represented by a “t” in the parser string.Ths same for the sixth and seventh bytes. State 4: The eighth byte is the Speed, known by the “s” in the parser.
The state machine is reset or restarted after the tenth byte.
If you declare the direction,steering angle and Speed as an int8 or a char, the final value for each parameter would be :
for direction:
direction = direction * 10 + received byte.
Direction = 0*10 + 1 = 1
Direction = 1*10 + 2 = 12
Direction = 12*10 + 2= 122

The following source code is for the Micrchip PIC16F876A, written in CCS.
Code : Here
Posted in Tutorials | No Comments »
Wednesday, December 31st, 2008 |
I finally get my hands on Analog Devices’ accelerometer- the ADXL202E. It’s small,very small.
See what I mean!

However there’s this problem, I usually work on PDIP packages and SMDs do give me a scare,not because I’ve never soldered them,but because I do not have the necessary equipment for it. So I decide to do my thing , and also take a little inspiration from Sparkfun’s Breakout board.
My first step was to find a thinner tip for the soldering iron. It presently has a standard tip,too big to solder the accelerometer. I decide to go shopping for a thinner one and get the finest one available at my local shop.
This is what the tip looks like[It's standard, I need a thinner one]

This is the new tip.

Since I needed to get wires out from the ADXL202 , I used very thin ones.You can easy get these by removing the insulation off normal wires you use in breadboarding. Now comes the difficult part – soldering.
First you need to hold your chip in place.With a little tape,firmly place the accelerometer on the table your working on.


This will prevent the chip from moving around ,when you solder the wires
First, put a little solder on one of the accelerometer’s solder points.Then taking a wire ,heat the wire, add some solder and touch it to the sensor’s pads. Do the same for the other seven “pins” of the sensor This is how it looked when done.[I know it's gory and ugly,but it's the best I could do]

Here’s the top view.

Now to mount the sensor onto a PCB. I chose a simple general purpose PCB[ dot matrix], as it’s easy available.That’s a One Ruppee coin,Indian currency ,the board is next to.

I cut the PCB to half to get a smaller footprint,that will house the ADXL202 and the supporting components. This is the finished version of the board:


If you notice,there are pins at the bottom of the board.These are for the signal and supply lines.I put them ,so that the board can piggy back on a bigger PCB housing the microcontroller…I also put a berg connector on the top,so that I could debug the signals. Following scope traces show the PWM changing as the accelerometer is tilted.
Tilted to one side:

Sensor on level surface:

Tilted to the other side:

Posted in Tutorials | 2 Comments »
Wednesday, December 31st, 2008 |
You’ve seen robots run on two wheels ,walk on two legs and balance just like us humans.I bet you’ve wondered whats in them that makes them “not tip over.
The device that enables this is a tiny teeny IMEM [aMicro Electro-Mechanical System] which can measure anything between ±1g to ±20g [some of the high g accelerometers measure ±20g to ±250g ]
The sensors:

What’s a “g”?
A “g” is a unit of acceleration having a value of 9.8
if you say 1g of acceleration .Its equivalent to:
1g = 1*9.8 = 9.8 m/s2
2g = 2*9.8 = 19.6m/s2
“g” in reality :
| 1g |
The acceleration exerted by the Earth’s gravity on an object or person (for example, a cell
phone on a desk experiences 1 g of acceleration). |
| 0-2g |
The acceleration range experienced by a person when walking. |
| 10-50g |
The acceleration experienced by an automobile in a typical crash. |
| 100-2,000g |
The acceleration experienced by a laptop if it is dropped from a height of three feet onto a
concrete floor. |
| 50,000g |
The acceleration experienced by a munition when shot from a cannon. |
…….Memsic.com
Where are Accelerometers used:
- Robotics
—To measure Tilt and Acceleration
- Vibration monitoring
—Vibration monitoring of heavy machinery
- Alarms and Motion Detectors
- Cellphones
—To invert the Phone screen so that the screen is always vertical
- Model Airplanes
—Detecting pitch and yaw
- Vehicle headlight aligning
- Disk Drives
- Vehicle Security
The following describes the two most popularly used accelerometers.
Both these accelerometers work on the same principle ,but on different technologies.
The Analog Devices ADXL202

Manufacturer :: Analog Devices
Datasheet :: pdf
Principle
The ADXL202 has a movable mass inside it which responds to vibrations,tilt or jerks.
The sensor element is a differential capacitor whose output is proportional to acceleration. The beam is made up of many interdigitated fingers.
Each set of fingers can be visualized as shown below:


Images Courtesy : Microchip.com
The movement of the beam is controlled by the polysilicon springs holding the beam.
These springs and the beam’s mass obey the laws of physics .
The force (F) on a mass (m) subject to acceleration (a), according to Newton’s Second Law, is
F = m a
The deflection (x) of a restraining spring according to Hooke’s Law is proportional to the applied force:
F = k x
From the above two equations…
a(acceleration) is proportional to x(displacement)
This enables us to compute the acceleration.
Once acceleration is obtained. Tilt can be obtained by monitoring each of the axes
The MEMSIC 2125

Manufacturer :: Memsic
Datasheet :: pdf
Principle
Unlike the Analog Devices ADXL which uses a movable beam, the Memsic accelerometers measure acceleration by monitoring a hot gas inside a chamber. The chamber is lined by a numerous temperature sensors which monitor the movement of the gas.
The picture below illustrates this:

Images courtesy of Parallax Inc. (www.parallax.com), from the Stamps in
Class Forum article”
How to – Accelerometer (1) Fundamentals and Tilt“
The first figure illustrates the accelerometer when it is held level.Note the position of the hot gas. The adjacent figure shows the accelerometer when tilted.The gas now shifts,changing the values of the sensors appropriately.
Output of an Accelerometer
Accelerometers like the ADXL and Memsic output their measurements in terms of PWM [Pulse Width Modulation].
For example take the ADXL202jqc which measures -2g to 2g. According to the ADXL datasheet 0g would translate to a 50% duty cycle.

A < than 0g readout with a lower than 50% duty cycle

A 0g readout with 50% duty cycle

A > than 0g readout with a greater than 50% duty cycle
Accelerometer AXIS
Both the above sensors measure 2 axis i.e the x and the y

Selection of an axis depends on your project requirements. You can even use the sensors to measure a full 360 degree of tilt. by using two accelerometers oriented perpendicular to one another.When one sensor is reading a maximum change in output per degree, the other is at its minimum.

Well thats it..these sensors do not need a lot of interfacing components. The ADXL202 just need 2 resistors and capacitors to set certain parameters while the Memsic needs even fewer components.
Posted in Tutorials | No Comments »
Wednesday, December 31st, 2008 |
Ever needed to measure temperature and display it? This project details measuring temperature using a temperature sensor ,an ADC and a Microcontroller PIC16f84a with schematics,codes and illustrations. This project was done fairly long ago, so please excuse the quality of the pictures.

Overview
The Temperature control module was a part of my Final year undergraduate project,which consisted of transmitting data wirelessly.
The module uses an inexpensive 8 bit Temperature Sensor the TMP37 from Analog Devices.
Since the data was analog and the PIC16f84 does not have an analog input,an external ADC had to be used.
Texas Instruments’ TLC549 was chosen for this.The advantage of this ADC was that it could communicate with the microcontroller serially.You may also use similar ADCs from Maxim-IC.
The LCD is a normal 16×2 display which uses the Hitachi Controller HD44780.
The module is breadboarded and not done on a PCB.Schematics are included in appropriate places below.
This site was a great help in building the project.
Mark S. Csele’s PIC Temperature Controller Page
Capabilities of the system:
-Show Current Temperature,Set temperature and Alarm Display.
-Go into Set Mode.
-Increment/Decrement Set Point.
-Enter Set point.
Here’s a snap of the module :

The project is divided into the following subparts:
-The Analog to Digital converter TLC 549 [8 bit]
-The Temperature Sensor TMP37
-The PIC16F84 / PIC16F84a Microcontroller
-Input Buttons
-The Liquid Crystal Display [LCD]
-Temperature Control
-Codes
Note:To follow this project you may need to know to program a PIC,there are some helpful links at the bottom of the page if you are not familiar with it.
The Analog to Digital converter TLC 549 [8 bit]
Description : The TLC549 is an analog-to-digital converter (ADC) integrated circuit built around an 8-bit switched-capacitor successive-approximation ADC. This device is designed for serial interface with a microprocessor or peripheral.
Pinouts:

Signals:
The TLC549 has two control lines and one data output line.
They are as follows:
-CS[bar] :: Input signal.The Chip Select signal.When low it selects/activates the chip.When high it disables the chip
-I/O clock :: Input signal.The input/output clock line is used to clock the ADC.
-Data Out :: Output signal.The data out signal clocks out bits into the PIC microcontroller.
ADC TLC549 on the circuit :

Working:
Sequence of events:See also datasheet page 8/10
- -CS is brought low The most significant bit (MSB) of the previous conversion result initially appears on DATA OUT when CS goes low.
- -The falling edges of the first four I/O CLOCK cycles shift out the second, third, fourth, and fifth most significant bits of the previous conversion result.
- -Three more I/O CLOCK cycles are then applied to the I/O CLOCK terminal and the sixth, seventh, and eighth conversion bits are shifted out.
- -The final (the eighth) clock cycle is applied to I/O CLOCK. After the eighth I/O CLOCK cycle, CS must go high or the I/O clock must remain low.
Resources:
Device Manufacturer :: Texas instruments
TLC549 Datasheet :: pdf
The Temperature Sensor TMP37
Description:
The TMP37 is a low voltage, precision centigrade temperature sensor. It provides a voltage output
that is linearly proportional to the Celsius (Centigrade) temperature. The TMP37 does not require any external calibration to provide typical accuracies of ±1°C at +25°C and ±2°C over the –40°C to +125°C temperature range. It is intended for applications over the range 5°C to 100°C and provides an output scale factor of 20 mV/°C.
Calculation:
If the Temperature is around 28 Degree Celsius. The TMP37 would be giving out a voltage of around 560mV
[.02*28=0.56V ie 560mV]
Pinouts:

Signals/Pins
-The Middle Pin [pin2]ie the Vout is directly connected to pin no 2 of the ADC TLC549.
-The rest of the 2 pins are the supply voltage of 5.0V and GND
TMP37 on the circuit :

Resources:
Device Manufacturer :: Analog devices
TMP37 Datasheet :: pdf
The PIC16F84 / PIC16F84a Microcontroller
There are two PIC16f84 microcontrollers handling the ADC/Temperature sensor/LCD and the input buttons.
The reason is that there weren’t enough pins on one PIC to control all the peripherals.So i had to use 2 of them and distribute the peripherals among them and also since I had a bunch of the same model.The two controllers communicate with each other serially.
Note : You may even use the PIC16f877 /A or the PIC17F874 /A microcontrollers from Microchip.They have alot more pinouts and the whole module can be controlled by a single controller.
The peripherals are distributed among the two microcontrollers in the following way:
-PIC-1 Handles the ADC TLC549 and Temperature Sensor TMP35
-PIC-2 Handles the LCD and the four Input Switches/Buttons to control the menu on the LCD
PIC-1
The first PIC16F84a ie PIC-1 collects data from the ADC and transmits them serially to the second PIC16F84a ie PIC-2.
The connection between the PIC-1,ADC and Temperature Sensor TMP37 is shown below:

PIC-1 with ADC and TLC549 on the circuit :

PIC-2
The PIC-2 handles all the LCD control signals ,the Temperature control and the Input buttons
Using the Input Buttons ,you can :
-Go into the Set Temperature Menu
-Increment the Set Point
-Decrement the Set Point
-Enter the Set point
The connections between the PIC-2 ,the LCD and Input buttons is shown below:

PIC-2 with the LCD and Input buttons :

Resources:
Device Manufacturer : Microchip
PIC16F84a Datasheet : pdf
Codes:
The code for both the PICs are given at the end of the page.
I’ve also used subroutines from other programs on the net and the author names are also mentioned in the included codes. Please give them credit and leave the names intact if you are planning to use the codes.
The Input Buttons
There are four input buttons for controlling the menu on the LCD.
-Button1 : Enter Set Mode
-Button2 : Decrement till released
-Button3 : Increment till released
-Button4 : Enter the desired set point
If the button is not pressed ,the PIC always gets a high.
If the button is pressed, the respective PIC pin goes low.
All the four buttons are connected to PortA of PIC-2
The input buttons on the circuit:

The Liquid Crystal Display [LCD]:
The LCD is a normal 16×2 Line display using the Hitachi controller HD44780. The LCD works in a 4 bit nibble mode,which means that the PIC first sends the lower bits of a byte and then the upper bits.
The connections to the 16×2 LCD are shown above under PIC-2 connections.
The LCD on the circuit:

References:
You may learn more about interfacing the LCD using the following links
Beginners Guide To LCD Interfacing :: RoboticsIndia.com
PIC Tutorial – LCD Board :: Nigel Goodwin
LCD Interfacing Reference Page :: Myke Predko
Build your own printer cable LCD Display :: Overclockers Australia
Resources:
Device Manufacturer : Hitachi Semiconductor
HD44780 Datasheet : pdf
Temperature Control
Temperature control is achieved using a simple on/off algorithm
Example :
If the desired Set Point is 29 Degree C.
The Alarm will activate if the tremperaturre >= 29 Degree C.
Sequence of events:
Initial display:

Display after initialisation:

Display on pressing the SET Button:

Deciding the Set point using the Increment /Decrement buttons:

Entering the Set Point at 29 Deg C [Enter button]:

Main Display after inserting the setpoint:

SET point exceeded..Alarm ON:

Codes:
ASM Code for PIC-1
ASM Code for PIC-2
Links for constructing your own PIC programmer
El Cheapo PICmicro Programmer :: Myke Predko
Pony Prog serial device programmer :: Claudio Lanconelli
Classic PIC Programmer :: bobblick.com
WinPic – A PIC Programmer for Windows
PICLIST.com :: A Heavy PIC resource
Posted in Microcontrollers, Tutorials | 12 Comments »
Wednesday, December 31st, 2008 |
Disclaimer : The information provided here is correct to my best knowledge.You may use it at your own risk.
This is a followup of the first tutorial which described using the port as an output. This tutorial demonstrates how to use the parallel port as an input. This feature is a great help in robotics as it is used to collect data of what the robot really is encountering.
The INPUT PINS

Picture Courtesy :: Ian Harries
The 10,11,12,13,15 pins of the STATUS PORT are the basic input pins.
Though the CONTROL PORT pins can also be used as inputs,only accessing the status pins are described here.Follow these steps to read an input
Step1
Construct the following TEST circuit.
In this example I have taken pin 13 of the STATUS port as an input.
WARNING Please do not feed your port more than 5V.You’ll blow it up.
Check all the voltages with a Multimeter before proceeding

Step2
Fire up your C compiler and typre the following program:

The program scans the STATUS[0x379] port and give an appropriate integer number,depending on what combinations of pins have gone high or low.
In this example ,since I have used pin 13 and connected to a high value i.e a binary “1″, I get a value of “127″ on my PC. Please note that this number will differ from PC to PC. Now we test for a Low value i.e a binary “0″. Modify the above circuit as shown below:

Short pin13 to GND.
When you do this and run the above program ,you get a different number.
On my PC ,i get a “230″
Step3
Now using a simple switch case statement you can monitor the input at pin13.

When pin13 is set HIGH:

When pin13is set LOW:

This is for monitoring a particular pin.
You can use all the status pins as inputs ,note down the numbers for different combinations and then write your program.Please note that the 11th pin is inverted i.e If u give a HIGH to it ,the port reads it as LOW.
That’s it for the parallel port inputs.
Posted in Tutorials | No Comments »