Finally laid our hands on an ADC chip. After looking up the datasheet on the net, I tucked myself in a cosy corner of the lab and got to work. The next one and an half hour was spent soldering wires and fixing the microcontroller to the sensors and ADC. The idea was to use one ADC for the three light sensors. The three IR Leds always remained ON and a transistor (base connected to the µC) in each of the sensors was used to start the phototransistors in a cyclic fashion (to get the readings of the three sensors one after another).
Three Leds were used to tell us the range of the output given by the ADC (for the light sensor whose phototransistor had been activated).
After the cricuit was done, Ankush and Vishesh got down to write the program (in C).
Apart from the fact that they were using C to control the µC for the first time (i think), they had major difficulties due to the peculiar behaviour of our lab's computer. Now whenever this computer senses that some important work is being done on it, and the user has forgotten to do the Ctrl+S routine it for some reason realises that to shutdown at that very moment will be a good idea. After a few tries they had to retreat to another PC (Win 98) and do their coding using Turbo C++. (and transfer it to the other computer to burn it onto the µC).
The circuit did not work in the first try (like always). We figured there could be many reasons- ADC wasn't working, wiring was loose, some problem with the code, we hadn't connected the ADC properly or weren't using it in the right way etc.
One confusion was regarding the "Vref/2" pin in the ADC. On thursday when we had tested the light sensors, they were giving an output range of 0V to 5V (for this range the datasheet required the Vref to be connected to ground). But on checking again, we found to our surprise that the output had now changed to 0V to 1.2V (and this required the "Vref/2" pin to be connected to +o.7V). We used a potentiometer to serve the purpose but the circuit was in no mood to work....
To close in on the victim, we connected 8 visible Led's to the ADC's output (hoping to observe some pattern) but all the Led's glowed continously (which meant the ADC was giving a value of 255 at all times). This confirmed our suspicions about the ADC - it wasn't working! and (as sir pointed out), the way we had tried to connect the three sensors to the ADC wasn't exactly correct.
With 30 minutes of school left (and a fried ADC) the only thing we could do was to see if the code was working, some tweaks here and there and we discerned that it was working perfectly (good work guys!).
All in all a SHIT day for me, hoping the singapore GP chirps me up... (go Kimi!)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment