Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Batienzaxcore on September 01, 2012, 10:28:24 AM

Title: Where to put FSR?
Post by: Batienzaxcore on September 01, 2012, 10:28:24 AM
Hey guys! I'm currently new in programming and electronics, even if I am on my 5th year as an Electronics Engineering student. As of now, I'm trying to do a circuit that employs the use of an FSR (Force-Sensing Resistor) that would automatically slow down the speed of a high-torque DC motor as the force on the FSR increases. I am using a PIC16F877A (Please don't recommend me those Arduinos; Iwanted to use them but my professor didn't allow me to us so, for some reason ~_~) uC, and I don't know how am I supposed to insert the FSR to the circuit. Please help me, since this is my final year project and I need to finish this badly.
Title: Re: Where to put FSR?
Post by: waltr on September 01, 2012, 11:00:59 AM
Hint3:
Look at the third word in the name FSR (Force-Sensing Resistor) and its data sheet!
Now refreash yourself with Ohms Law and voltage dividers.
The PIC16F877 (oldie but a good one that I still use) has several ADC inputs.

Got it yet?

Since you are a 5th year engineering student I will not give you the direct answer. You should easily figure this out with the above hints.

Since this is a hobby forum please post back with your solutions so other can also learn.
Or post with additional questions.
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 01, 2012, 11:05:02 AM
Hmmm thank you mr. waltr. Upon checking google, I noticed that soe FSRs use resistance-to-voltage circuits using an op-amp. So does that mean I should put the output of the op-amp to one of the ADC inputs?
Title: Re: Where to put FSR?
Post by: waltr on September 01, 2012, 11:27:59 AM
yes.
Read the PIC data sheet about the ADC input requirements to see one reason why this is a good solution.

Don't restrict searches to just FSR.
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 01, 2012, 11:37:02 AM
You see, Mr. Waltr, the reason why I used an FSR is because... I don't know why, actually :D

Seriously, I used an FSR in my project that is an exoskeletal knee robot manipulator that would flex and extend the knee of a person. The FSR would then be included in the robot, wherein it would slow down the speed of the DC motor that acts as the flexer/extender of the knee. It's kinda complicated to explain here. Anyway, my only concern is about the FSR. Thank you for your help :D I will reply here as soon as I finish my work.
Title: Re: Where to put FSR?
Post by: waltr on September 01, 2012, 03:28:53 PM
How the FSR is used in the control algorithm is independent of how you need to wire it into a circuit and measure its value with the PIC. Get the latter working first.

More hints to add to the ones already given:
What is the resistance range of the FSR?
How will you convert its resistance into a voltage?

Have you gotten the PIC code working to measure a voltage?
Hint: Start with a potentiometer connected to an ADC input.
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 02, 2012, 07:19:05 AM
Currently Mr. Waltr, the resistance-to-voltage circuit that I have seen in the internet employs a voltage divider using the FSR and another resistor in a voltage divider setup, as well as an op amp used as a buffer.

The problem now lies in my ability to program the ADC input of the PIC16F877A, which I find difficult actually, since my strength is Mathematics, not programming ^^ Anyway, I will reply soon once our proposal has been approved. In the meantime, I will be practicing on the potentiometer to ADC circuit that you have recommended :)
Title: Re: Where to put FSR?
Post by: waltr on September 02, 2012, 11:18:34 AM
Ok. Get the circuit working.

Since the PIC16F877 is very popular there is much code examples around. However, I suggest using Microchip documents. Start with the Data Sheet for the PIC16F877.
There is also a Mid-range Family Reference Manual that goes into a little better detail on each of the PICs features.
Now, and this is one reason PICs are popular, Most PIC all work exactly the same. So when you know how to use the ADC on one PIC another works the same way and many times that piece of code will work without modification (or very slight mod). I saying this because if you find ADC info that uses a PIC16F887 DO read it as the ADCs work the same.

Latly, Microchip has a lots of App Notes. These show how to use various feature of PICs and there is much to be learned from them. So also spend time looking through the App Notes.
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 02, 2012, 12:18:36 PM
That would seem to be one of my problems. The only microcontroller that I have worked on before was a 16F84A. Rather large transition, eh? :D
Title: Re: Where to put FSR?
Post by: waltr on September 02, 2012, 12:45:30 PM
Not really. The PIC16F84 is the first PIC I used. The PIC16F877 just has more features so everything that works on the F84 works on the F877. This means you don't have to unlearn anything but just learn the additional features, like ADC and UART that the F84 does not have.
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 03, 2012, 07:36:09 AM
I'll have to learn a lot about this. Haha. Thanks. I'll reply soon once I fix this.
Title: Re: Where to put FSR?
Post by: Soeren on September 03, 2012, 09:11:54 AM
http://learn.adafruit.com/force-sensitive-resistor-fsr (http://learn.adafruit.com/force-sensitive-resistor-fsr)
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 04, 2012, 01:19:27 AM
Thank you Mr. Soeren. You have been helpful as well :)
Title: Re: Where to put FSR?
Post by: Batienzaxcore on September 05, 2012, 08:20:01 AM
Oooops. A lil' bit of modification came in. In my project, I would still be using the FSR in the ADC input of the PIC16F877A uC, but this time, once the FSR has been triggered, the uC would have to bring back the motor to its initial position. Anyway, that would be in a different topic, so I'd post another one on the other categories. Thanks to the two of you! :D