3.3v and 5v, oh my!

Forgive my ignorance of Arduino 101 here. I'm sure this question will register as 'how can he not know that', but my Googling about has only made me more confused.

I've got a project with a microcontroller (technically, I'm using an ESP8266-12E at present), and I want to power it with a single 3.7v li-ion, akin to one of these:

https://www.amazon.com/dp/B0154NRFVE

The controller and the components (buzzer, LED) can all be driven with 3.3v, except for the ultrasonic sensor (HC-SR04) which requires a good 5v. I tried it with 3.3v and it didn't work very well.

Soooo...how do I make the sensor work with this project? In my tiny little newb brain, since the battery only provides 3.7v, I can't really make use of the 5v pin on the ESP8266 to power the sensor. Is that right?

I read articles about using transistors or relays to resolve the problem, but they don't make sense to me. They look like special sorts of switches, not things that would pull up the voltage the way I'm wanting.

Note: I don't want to add a breakbout board or anything like that if at all possible. So, no SparkFun Logic Level converter.

Thank you!

In my tiny little newb brain, since the battery only provides 3.7v, I can't really make use of the 5v pin on the ESP8266 to power the sensor. Is that right?

Yes. The 5V pin will not measure 5V when you only supply 3.7V.

I read articles about using transistors or relays to resolve the problem, but they don't make sense to me.

A transistor is a switch. It can switch high(er) voltage using a low(er) voltage signal. A relay will do the same thing. But, you have to have a higher voltage source to start with. You are going to need to make or buy a boost converter, or use two batteries.

The voltage on a Lithium battery will be a bit too high for an ESP8266 as its permitted max is only 3.6v. When the Lithium battery is charged its voltage will be about 4.2v.

A simple way to bring the voltage into range is to feed it through a silicon diode which would drop it by about 0.6v.

...R

PaulS: Yes. The 5V pin will not measure 5V when you only supply 3.7V. You are going to need to make or buy a boost converter, or use two batteries.

OK - now we're getting somewhere. Down the road where I'm using SMT, something like this might suffice?

http://www.mouser.com/ProductDetail/Texas-Instruments/TLV61220DBVR/?qs=l6ZoeTYLMwOr7SC1DbpfZQ%3D%3D&gclid=Cj0KCQjw9afOBRDWARIsAJW4nvwqAy5ULGJ4x9QUUFbuYADcdysCh1FAwRWtzJrQT09gVykM4FuUobUaAiFiEALw_wcB

Robin2: The voltage on a Lithium battery will be a bit too high for an ESP8266 as its permitted max is only 3.6v. When the Lithium battery is charged its voltage will be about 4.2v.

A simple way to bring the voltage into range is to feed it through a silicon diode which would drop it by about 0.6v.

...R

Good tip! I had known this issue was on the horizon, but I hadn't addressed it yet. I had thought I could just use a voltage regulator, ala this thing?

https://www.sparkfun.com/products/526

elveax: OK - now we're getting somewhere. Down the road where I'm using SMT, something like this might suffice?

http://www.mouser.com/ProductDetail/Texas-Instruments/TLV61220DBVR/?qs=l6ZoeTYLMwOr7SC1DbpfZQ%3D%3D&gclid=Cj0KCQjw9afOBRDWARIsAJW4nvwqAy5ULGJ4x9QUUFbuYADcdysCh1FAwRWtzJrQT09gVykM4FuUobUaAiFiEALw_wcB

Unless you are very experienced at SMT design, you should not attempt to use that chip. You need to add a lot of components to make a useable power supply out of that chip and the design will be extremely sensitive to the precise PCB layout. Buy a module which uses that chip, if you like it so much. Then all the sensitive layout is done for you. Or just any module which meets your requirements for voltage and current. I like the ones from pololu.com

make use of the 5v pin on the ESP8266

Well, an esp8266 chip does not have a 5V pin. Esp-12 modules don't have one either. So what are you really using? A NodeMCU? A Wemos Mini?

If it's a Wemos Mini, that has an ideal voltage regulator, from a Li-ion point of view. Unlike a simple diode, it will drop just enough to reach 3.3V, and when the battery voltage drops below that, it will only drop 0.2V. However, it cannot create 5V, and nor can any other regulator.

Ultrasonic sensors are one of a few remaining popular Arduino components for which there is no cheap and commonly available 3.3V equivalents. We as a community should be looking to do something about that. Finding, recommending, exercising our group buying power, that sort of thing.

PaulRB: Well, an esp8266 chip does not have a 5V pin. Esp-12 modules don't have one either. So what are you really using? A NodeMCU? A Wemos Mini?

Correct - NodeMCU. Eventually, I'll be wanting to put the ESP8266 on a PCB by itself, however, so I imagine I'll need to have whichever step-up device I use in-line between the power supply and the sensor? And then a voltage regulator between the power supply and the VIN on the module?

Let's go back to basics. Why have you chosen a Li-ion battery? Maybe it is not the best choice.

...R

Robin2: Let's go back to basics. Why have you chosen a Li-ion battery? Maybe it is not the best choice.

...R

I'm going to be trying to squeeze everything onto a relatively small board and don't want to make room for a 9 volt or four AA's. Plus, I'm planning to crank out a few dozen of these, and I'd rather buy a few dozen Li-Ions than 48 AA's. And I'd like these to be rechargeable so I don't have to keep replacing them.

Aren't those the reasons anyone chooses a Li-Ion?

elveax: Aren't those the reasons anyone chooses a Li-Ion?

They are part of the reason.

But it is also necessary to consider what is the best (cheapest, smallest, least amount of effort ???) way to provide the voltage(s) that are needed by the project.

One option might be 3 x AAA cells with a tap taken off 2 of them (3v) to power the ESP8266 and the full 4.5v for the other stuff. Don't underestimate the convenience of just replacing alkaline cells when they are depleted. No charger needed. No fire risk. No down time waiting for them to recharge.

Or a 2S Lithium battery with a suitable regulator.

How big physically is the Li-Ion cell you are thinking of using?

...R

Robin -

Well, you expose my ignorance of how these things work again :P I understand that I could provide the ESP8266 a range of voltages (somewhere between 1.5 and 3.3v) and it should work OK, so a pair of AA's would suffice. But if I've got an ultrasonic sensor that requires 5v and I provide it with 4.5v, won't I run into the same problems I did when I provided it 3.3v?

Also, let's just say for the sake of argument I went with a 9v. My understanding is that I'd be in the same boat - I'd just need to provide two step-down converters/voltage regulators (one for the ESP8266 and one for the sensor) instead of a step-up and step-down converter.

It seems to me I'm going to have to step up or step down my voltages in my project no matter what, unless someone feels like making me cheap, easily available 3v ultrasonic sensors :P

I've got a batch of knock-off HC-SR04 ultrasonic sensors from Amazon. They advertise needing 5v and, sure enough, they require 5v. If I give them 3.3v they flip out and can't detect a thing.

But, some eBay ads for these show that they work at 3v, with shorter ranges. Does anyone know if this is true, or just false advertising?

http://www.ebay.com/itm/3V-5-5V-HC-SR04-Ultrasonic-Module-Distance-Measuring-Sensor-for-Arduino-UNO-MCU-/162136588777?hash=item25c01801e9:g:iTwAAOSwXrhXmyCY

I can order some myself and test them, of course, but if anyone has experience I'd like to save myself the time and money...

There are a lot of different design all claiming to be the same, it is difficult to give you an answer

Your best option is to buy them and also buy a step up conver or booster Trust me if you will continue play with arduino one day you will need it

Karma+ Bye

I tried out a couple of the HC-SR04s I have at hand and they don't work at 3.3V. These use a MAX232 to drive the transmit transducer and that's a 5 volt only part. There may well be other issues with the design at low voltage.

The sensors linked in the first post clearly use a different chipset so it's not impossible that they do work over the advertised 3-5.5 V range. That said, these sorts of eBay listings are notoriously unreliable. Of note, this design apparently is using an 8 pin microcontroller without an external crystal.

I bought a few off Taobao and they work fine on 3.3V. Not sure what the page said about working voltage, it was at the beginning of my microprocessor career and I just rather randomly got together some stuff hoping it all worked :-)

The solution is in your other thread about this subject.

Get a 3.3V capable HC-SR04.

elveax: But if I've got an ultrasonic sensor that requires 5v and I provide it with 4.5v, won't I run into the same problems I did when I provided it 3.3v?

I don't know. 4.5v is an awful lot closer to 5v than is 3.3v. If it was my problem I would certainly do some experiments to find out if it would work. A 5v Uno or Mega works fine on 3 x AA cells.

...R

It looks like two threads were merged so the flow of comments is a bit confused, but I gather that the HC-SR04 modules that look like this are 5 V only (these are what I have on hand): |500x375

The HC-SR04 modules that look like this apparently will work at lower voltages per "wvmarle" post. Note the designation on this board is HC-SR04*P*: |500x500

As always, when ordering on eBay one may not get exactly what was pictured in the ad. Regardless I've ordered a couple of the latter design with the plan of trying them out and reporting back when I get them.

MrMark: The HC-SR04 modules that look like this apparently will work at lower voltages per "wvmarle" post. Note the designation on this board is HC-SR04*P*:

Yes, the second ones are exactly like the sensors I have, including the HC-SR04P designation on the back (on the front it's HC-SR04, without the P). Working fine on 3.3V.