Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Thread Tools Display Modes
Old 28th January 2008, 09:27 AM   (permalink)
Default Using ADC function of pic16f877

Hi all,

i am doing a project regarding a force sensor and a microcontroller.the basic idea of my project is i need to monitoring the force excerted to the sensor and using microcontroller to control/position my tools.so that my tool is always floating ,for this i need to convert the force to digital form and monitoring it thru microcontroller.my force sensor is powered with 12Vdc so that my range would be from 0v to 12vdc.but from what i know is the allowable analog input for microcontroller is just 5V.So any alternative method can i use?
Thanks.
mesamune80 is offline   Reply With Quote
Old 28th January 2008, 09:56 AM   (permalink)
Default

A simple attenuator is all you need, just like your multimeter uses.

If you check my tutorials my analogue one uses an opamp buffer as well.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 28th January 2008, 10:03 AM   (permalink)
Default

Assuming that when your tool is floating the output voltage is zero, you could just use a resistor to limit the current into the pic and rely on the clamping diodes to ensure the pic only sees 5V. You would then get a reading that went from 0 to 1023 as the sensor went from 0 to 5V and a reading of 1023 for sensor voltages above 5V. If you wanted to be doubly safe you could use a 5.1V zener from the pic pin to ground.

Mike.
Pommie is offline   Reply With Quote
Old 29th January 2008, 02:46 AM   (permalink)
Default

Thanks guys i'll give it a try then,i'll update my project progress as i proceed. :-)
mesamune80 is offline   Reply With Quote
Old 29th January 2008, 06:12 AM   (permalink)
Default

Hi nigel,just now i went to your website and i found the analogue input board you have in your tutorial session,i wonder what is the key point for me to determine the value of all the resistor ? can i just substitute them with a different value resistor?
mesamune80 is offline   Reply With Quote
Old 29th January 2008, 09:30 AM   (permalink)
Default

i would like to do a full scale caliberation,for instance if my input is 12v then the analogue input to my uC is 5.0V .if my input from my sensor is less, then the analog input also will change corresponse to my sensor input voltage.how could i manage to achieve this?Can i just use two resistor ,act as attenuator,so to get the approximate value 5.0v to my uC pin? Thanks

Last edited by mesamune80; 29th January 2008 at 09:34 AM. Reason: update..
mesamune80 is offline   Reply With Quote
Old 29th January 2008, 09:38 AM   (permalink)
Default

Yes, all you need is two resistors as an attenuator - but it depends on the relative impedances, which is why I use a buffer opamp on my tutorial board.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 30th January 2008, 01:24 AM   (permalink)
Default

okie,this should make things easy,thanks guys. ;-)
mesamune80 is offline   Reply With Quote
Old 30th January 2008, 05:39 AM   (permalink)
Default

what is ther tolerance voltage for analogue input pin for 16f877 ? if i use 2 resistor as attenuator then i doubt that i can get exactly 5v from 12v. if i would like to use 3 channels is it the same configuration i use?
mesamune80 is offline   Reply With Quote
Old 30th January 2008, 10:00 AM   (permalink)
Default

Quote:
Originally Posted by mesamune80
what is ther tolerance voltage for analogue input pin for 16f877 ? if i use 2 resistor as attenuator then i doubt that i can get exactly 5v from 12v. if i would like to use 3 channels is it the same configuration i use?
You don't have to get exactly 5V, slightly under would be fine. Inputs should be current limited so the protection diodes can protect the chip if you apply too much voltage.

If you check my tutorial hardware you will notice that I include a resistor between the opamp and the chip for this reason, and that the opamp is fed from 5V, so can't go above 5V anyway.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 31st January 2008, 09:40 AM   (permalink)
Default

so inorder for me to get 5.0V for full scale i must use the programmable shunt regulator connect to +Vref?is it possible for me to use just two resistor for down sclae my readings?
mesamune80 is offline   Reply With Quote
Old 31st January 2008, 10:13 AM   (permalink)
Default

Quote:
Originally Posted by mesamune80
so inorder for me to get 5.0V for full scale i must use the programmable shunt regulator connect to +Vref?is it possible for me to use just two resistor for down sclae my readings?
As long as your input voltage is higher than Vref you can use a simple attenuator to reduce the input voltage, exactly as your meter and scope does. But pay attention to the impedances.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 1st February 2008, 02:44 AM   (permalink)
Default

Thanks Nigel,just now I use EWB to simulate a part of your analogue input circuit ,i noticed that the output form the opamp is about 6.5V ,my input voltage to my opamp is 12V .if i don't use a zener or shunt regulator ,then the output voltage would be too high for my pin, i think?if i just follw exactly your circuit would it be enough for my project?
mesamune80 is offline   Reply With Quote
Old 1st February 2008, 09:36 AM   (permalink)
Default

My circuit is limited to 5V because that's the supply voltage, using a 12V supply obviously means you can potentially get 12V applied to the PIC pin.

My circuit, as is, is designed to accept an input of 0-10.23V - you just need to alter the front attenuator to change that.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline   Reply With Quote
Old 15th February 2008, 04:23 AM   (permalink)
Default

Okay so i just need to alter the front attenuator to accept 12v input voltage.
Thanks.
mesamune80 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
ADC troubles andy257 General Electronics Chat 4 2nd December 2007 05:49 PM
Urgent!!!! Pic16f877 Adc preeste Micro Controllers 4 23rd November 2007 07:43 PM
Problem with multiple ADC using pic16f877 andyto Micro Controllers 15 24th September 2007 10:47 PM
Line Detection Robot using PIC16F877 helmyshahryl Micro Controllers 0 28th August 2007 01:53 AM
Binary division Kenyan algorithm 18F family atferrari Micro Controllers 6 3rd May 2007 08:26 PM



All times are GMT. The time now is 11:52 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.