Need help with voltages in pi pico

August 8, 2024, 05:59

rat_is_the_best

I'm doing a home automation project, In my bathroom I have a room freshener, that sprays every 10 minutes. It has a replaceable can, like a pressurized deodorant. It seems to work based on a motor, first it rotates clockwise then counterclockwise, to move the levers that push the spray. My aim: It should detect movement in the room every once in 10 seconds. When movement is detected, it should spray and then sleep for 30 mins. I have some experience in pico and basic electronics. Now my question is on controlling the motor, In the exiting setup, the motor seems to use around 3-4v and consumer around 150mA current. The setup runs on 2 AA batteries. I'm thinking of using a pico, and a motor driver like L293D to control the motor. But the L293D seems to need 5v for logic, but the pico provides only 3.3v. How can this be solved? Also the L293D seems to need 4.5v atleast for the supply, I was thinking of using a single 3.7v 18650 battery to power the pico and the motor driver. But that will not give 4.5v to the L293D. So do I need 2 18650 batteries in series to power the L293D? In that case charging becomes difficult, as I can't just use a tp4056 directly. For the motion sensor, I was thinking of using HC SR501, that also seems to require 5v.

oops.se

Those air freshener is a PITA for asthmatic people. - L293D, replace it with a DRV8830 or you could use a level converter (3,3v -> 5v) - Battery. You could use a DC/DC step up converter to convert a one cell to 5v. This will make the above answer obsolete. - HC SR501 can be modified to work with 3,3 volt, check https://screenzone.eu/modify-hc-sr501-pir-sensor-to-work-with-3-3v/

rat_is_the_best

awesome, thanks. is it common to use step up converters in these kind of projects? will they not use some power continuously ?

rat_is_the_best

I think I had a step up converter that had an LED glowing full time, should such LEDs be removed to save power?

oops.se

Some DC/DC converter has a high quiescent current consumption (AKA Idle consumption). You need to add that to your check list when choosing a DC/DC step up converter.. And yes of course a unnecessary LED can be removed or the resistor that is in series with the LED.

abovefreezing

note: I sometimes will include diodes in motor control circuits to protect the controller from back-emf currents. Sometimes it seems to not be necessary but other times it seemed to have saved my controller from damage. I'm not expert in this but it may be worth learning about

oops.se

That is called a "Fly back diode" https://en.wikipedia.org/wiki/Flyback_diode and is necessary to protect all driver circuits that control inductive loads. And <@1162083540612157491> you are correct that some times the "fly back diode" is included in the driver.

abovefreezing

Thanks! I'll add "flyback diode" and inductive loads to my list of things learned