Step 7Calibrate your MCU readings
The resistor keeps you from releasing the magic smoke from your MCU when the potentiometer is at one of the extents of its travel.
Provide your MCU with a power source, and attach your serial cable. Open your favorite RS232 Terminal program and watch the readings come in.
What I was looking for first was the highest/lowest possible voltage reading the ADC would register.
I put those numbers in my firmware, used some fancy number-math on my voltmeter code, recompiled, reflashed, and started my terminal program back up. By the way, "_udivsi()" is tricky to track down. Apparently, LPC2000 MCU's don't like to do division. Neither do I, so we agreed to disagree.
The next set of numbers I wanted was the voltage when the carousel pointed straight forward, left, and right. I found that the carousel can turn much farther left and right than you can get meaningful numbers from. I did get good readings for about a full 180 degrees, so I could point my camera from full-left to full-right. Again, I added these numbers into my calculations in firmware. This makes the reading taken from the potentiometer into a somewhat reliable sensor reading.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|














































