Author Topic: Sharp IR sensor @5V with PIC32 @ 3.3V?  (Read 5110 times)

0 Members and 1 Guest are viewing this topic.

Offline electrofanTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Sharp IR sensor @5V with PIC32 @ 3.3V?
« on: July 20, 2010, 04:02:27 PM »
Hello,

I was wondering what the best way of implementing a sharp IR sensor on my 3.3V board would be? Looking at the datasheet, the sharp IR has a recommended range of 4.5 to 5.5v, but it looks like its output only goes to 3.3V...should I run it at 5V and hook it up directly to my PIC? should I run it at 3.3V (outside the recommended range)? or should I put a level converter in between the PIC and the IR just in case (any recommendations for converters?)?

Thanks guys.
« Last Edit: July 20, 2010, 04:32:37 PM by electrofan »

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #1 on: July 20, 2010, 07:59:04 PM »
I don't recommend running the Sharp at 3.3V. I'd run it from a separate 5V regulator and connect its analog output through a series resistor to the PIC ADC input. PICs do have diodes on their pins to Vdd & Vss so a series resistor will limit the current the diodes clamp if the voltage exceeds Vdd + a diode drop. This is just an 'What If' precaution and may not be needed.

Also wire up the Sharp and measure the output voltage to verify the data sheet. If you feel the the Sharps output never exceeds 3.3V then just wire it directly to the PIC.

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #2 on: July 21, 2010, 05:16:26 AM »
This is an interesting question.

I was thinking of a similar setup, a Mega168 at 3.3V powered by a 3.7V LiPo.  What if the sensor is connected directly to the battery, before the 3.3V regulator? Does it need a Buck up converter, or a voltage doubler and a 5V regulator, then logic voltage level converters? Or are there different (IR or US) sensors that work at 3.3V?

Are we stuck with 5V for robotics?
Check out the uBotino robot controller!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #3 on: July 22, 2010, 08:32:46 AM »
Which Sharp IR sensor? Some will work at 3.3V.

I say just hook it up and see what happens. ;D

note: you may need to recalibrate your ADC value to distance equation

Offline electrofanTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #4 on: July 22, 2010, 05:24:50 PM »
I tested it out, and my IR (GP2D12) seemed to max out at around 3.3V most of the time, however, for some reason it gave me higher readings from time to time. Not sure why. Anyway, I've decided to use a voltage divider as per microchip's recommendations for now. I only have one PIC development board, so I do not want to risk running 5V into its ADC pin at this point :D

Also, an unrelated question. I am planning on using the following battery pack for my robot: http://www.all-battery.com/12v2000mahnimhbatterypack11606.aspx

I was considering building my own charging circuit. However, due to time constraints I don't have the ability to prototype it on a breadboard before I create PCB. So I've decided to go with a wall charger instead. I was wondering if anyone has used/recommends any of the following chargers for my pack:

http://www.all-battery.com/smartuniversalchargerfornimhnicdbatterypack7-2v-12v-01020.aspx
http://www.all-battery.com/12v2aswitchingpowerbatterycharger.aspx
http://www.all-battery.com/15vuniversalchargerfor12vto144vnimhnicdbatterypackswithdcconnector.aspx

The last one seems to be unmonitored, though. I'm leaning towards the second one due to a tight budget. However, its DC output current is 2A, and my pack is 2000mah, so I am a bit concerned about that.

Thanks again guys.
« Last Edit: July 22, 2010, 05:27:10 PM by electrofan »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #5 on: July 22, 2010, 05:42:28 PM »
Maxing out at 3.3V is expected. If your sharp IR sensor goes outside its range, it'll give unreliable readings (different readings each time you do it).

Voltage dividers are very much a bad idea for powering things. Definitely use a voltage regulator!

As for your other question, better to create a new thread for that ;D

Offline electrofanTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #6 on: July 22, 2010, 09:24:40 PM »
Hey. I meant I'm using a voltage divider on the output of the sharp IR going into the PIC32. Since it's an analog signal, I assume this will not cause problems with floating, but will just reduce resolution to a factor of 3.3/5.

And If I change my mind, I can take the grounded resistor out of the divider and replace the series resistor with a different value, as was suggested earlier. Let me know what you think of this.


I'll make another thread about the batteries then, did not want to clog up the forum with my posts   :P
« Last Edit: July 22, 2010, 09:27:43 PM by electrofan »

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #7 on: July 23, 2010, 07:28:49 AM »
Hey. I meant I'm using a voltage divider on the output of the sharp IR going into the PIC32. Since it's an analog signal, I assume this will not cause problems with floating, but will just reduce resolution to a factor of 3.3/5.

And If I change my mind, I can take the grounded resistor out of the divider and replace the series resistor with a different value, as was suggested earlier. Let me know what you think of this.
sounds good to me!

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Sharp IR sensor @5V with PIC32 @ 3.3V?
« Reply #8 on: July 24, 2010, 09:39:47 PM »
Hi,

Hey. I meant I'm using a voltage divider on the output of the sharp IR going into the PIC32. Since it's an analog signal, I assume this will not cause problems with floating, but will just reduce resolution to a factor of 3.3/5.
Just watch the impedances, or your readings will be off.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


Get Your Ad Here