Hi im doing a project for college and I got some doubts about signal conditioning. Im using a SS49E, hall sensor and, from what I have seen in the data sheets, the analog output gives values between 1v-4v. I want to read the analog output in the uC(ATMEGA88) with values between 0v-5v. How can I do that? This is a subject in the college that is supposed to teach me how to manually condition a signal, so I can't change the code. Thanks in advance.
Use an inverting Op-Amp configuration with a gain of \$\frac53\$ to scale your (4-1)V = 3V range to a 5V range. Then, use another opamp to add that to a constant 2V source.
Implementation's up to you, Opamp circuits can easily found on the internet (wikipedia!) and easy to implement, so this is actually more help then you should have needed as a college student.
I would have answered with a link, however, this is a trap!
Let's have a look at the sensor datasheet page 3. The sensor's output is able to source up to 1mA (minimum guaranteed) however the schematic at the bottom of the page shows the output can only sink a current of 65 µA.
Thus we have to be careful not to use a circuit that would require the sensor's output to sink more current than this. For example an inverting opamp configuration would need high value resistors.
So, consider an inverting opamp with a gain of 5/3. The positive input of the inverting opamp should be at midsupply, biased by resistors, to ensure the output range is correct. I'm trying not to give you a solution that's too easy, therefore no schematic!
Output voltage would be inverted (1-4V in to 5-0V out instead of 0-5V), but you can fix that in software, there is no reason to add another opamp to invert it again.
Now, calculate the max current that the sensor's output will have to sink when its output is 1V, depending on the opamp's feedback resistor. Pick a resistor value that doesn't exceed the 65µA limit (or let's be safe and say 30µA). This will probably need a FET opamp.
Now check opamp input current and noise due to resistors, and decide if you will add another opamp before as a voltage follower to be able to use lower value feedback resistors. Your call.
Opamps will need to be rail to rail output if supplied from 5V.
Note this is fine as an exercise but in a real design you wouldn't want to use the last fraction of volt near the rails, as rail to rail opamps performance does degrade a bit close to the rails... and in this case, adding an opamp isn't worth it since the signal is large enough for your ADC.
I think I would do it this way.
(Well actually I would not do it at all and let the micro handle it as is.. but hey... that wasn't the question.)
R3 provides the load for the hall sensor to keep it sourcing current. The voltage over that resistor is then amplified by OA1 around the buffered half rail bias voltage provided by R1,R2 and OA2.
Note, nothing inverts in this circuit.
R6, D1 and D2, ensure the op-amps can never over-drive the next device.