jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Which Power solution for a several sensors project?

Fri Jan 03, 2020 4:26 pm

Hi!

I am working on a baby phone, based on ivadim's project (here: https://github.com/ivadim/fruitnanny) and Raspberry Pi 2. I made some little add-ons (here: https://github.com/jeremyfritzen/fruitnanny, even if I didn't commited last updates yet), based on 3 additional sensors:
- temperature/humidity sensor (like this: https://www.adafruit.com/product/385)
- sound sensor (like this: https://www.amazon.fr/gp/product/B06WLH ... UTF8&psc=1)
- motion sensor (like this: https://www.adafruit.com/product/189)

Everything works and I am notified each time one of these sensor detects something (temperature too high or too low, sound detected above a threshold, motion detected) but my installation is not very stable...

Indeed, I think need to use a Raspberry Pi 4 or Raspberry Pi 3 at least.
But mainly, I think the Raspberry Pi hasn't enough power for all of these sensors at the same time (+ all running docker containers).

That's why I think I need to change the power supply for the sensors.
I know a lot of power solutions exist but I'm very lost about power concerns. Which solution would you recommend? I am especially looking for something:
- that takes few space
- if possible, that is easilly portable
- that is as cheap as possible...

Thank you so much for your help!

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Which Power solution for a several sensors project?

Fri Jan 03, 2020 6:17 pm

Seems you mix several things : cpu usage and power supply requirements.

First i'm surprised rpi3 can t make this application, it s not so complicated and if you have cpu issues you should work on the software.

Then, about power supply, you should avaluate how many power each of them require. Plus rpi consumption. Then take a margin and you have total power consumption the supply should be able to provide. Datasheets will help you.

Which kind of supply have you today?

jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 8:55 am

Hi,

Thanks for your reply.
I'm sorry, indeed I wasn't clear.
I have 2 concerns: CPU usage and Power consumption.

About CPU usage, I am currently using a Raspberry Pi 2 and it's a little limited for my project. Maybe I didn't make the right choices but I added a new Docker container for each new sensor monitoring (and related notification), for a total of about 8 containers. Based on top command, it's way too much for my Raspberry Pi 2 (maybe because my images are too heavy ; I'm pretty new on Docker). That's why I am considering 2 options:
  • 1. Reduce the number of containers since I didn't manage to reduce more containers weight. Basically, my 3 new sensors monitoring scripts would be added into 1 docker container. Not very "clean" solution but my first tests allowed me to reduce the CPU usage.
  • 2. Host my containers on a Raspberry Pi 3 (or 4).
Power consumption is actually my main concern.
I've read that each pin of the Raspberry Pi can't provide more than 16mA and all pins together can't provide more than 50mA. With all sensors connected to my RPi 2 (DHT22 sensor, PIR sensor, KY-038 sensor for sound and probably LEDs) + consumption of the Pi itself (with its camera), the whole consumption is way too much and the Pi can't provide enough current in a reliable way.
Even if I don't know how much Ampere do my sensors need (I can't find the information...), I am pretty sure that is too much (for RPi2, 3 or 4). That's why I am looking for solution to provide enough current to RPi and all of its sensors.
Do you have something to recommend? I know there are plenty of solutions but it's hard to figure out which one is the best (and cost-effective).

I hope it's clear!
Thank you very much for your help!

aBUGSworstnightmare
Posts: 1611
Joined: Tue Jun 30, 2015 1:35 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 9:07 am

GPIO pins are not intended for powering something! Your sensors have a data sheet, search the web for them and you know each sensors max requirement.

Now design a suitable DC/DC (or buy annoff-the-shelf board) that is able to supply your sensors. Only the communication interfaces (i.e. SPi, UART, I2C) are connected to the RPi GPIO

jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 9:37 am

GPIO pins are not intended for powering something!
GPIO are not but there are 5V pins on the Raspberry Pi. It's enough to power 1 or 2 components but not more in my opinion.
Now design a suitable DC/DC (or buy annoff-the-shelf board) that is able to supply your sensors
Do you have something to recommend?

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 2:21 pm

About CPU usage, clearly your choice are not recommended at all. Why using docker ? You should just install your scripts/applications on the Pi itself. Simple and efficient. Just try and compare CPU usage, I'm sure you will be surprised !

About the Power Consumption, it's not very clear, can you provide a schematic of the wiring you have done please ? Maybe you just not need any DC/DC converter. Or maybe you are making a confusion between GPIO current and supply voltage current of the sensors.

jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 5:56 pm

Here is the wiring.
Rpi_nanny.png
Rpi_nanny.png (183.28 KiB) Viewed 401 times

If needed, you will find below links to the components I am using:
- temperature/humidity sensor (like this: https://www.adafruit.com/product/385)
- sound sensor (like this: https://www.amazon.fr/gp/product/B06WLH ... UTF8&psc=1)
- motion sensor (like this: https://www.adafruit.com/product/189)

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 7:39 pm

You currently supply the sensors from 5V or 3.3V, not from the GPIO themselves which are only used to provide sensor status. Thus, no current is drawn from the GPIO to supply the sensor. Your wiring is what you have to do no modification required.

What is the problem on your system with the power consumption ? Are you just afraid ? You should not.

jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Re: Which Power solution for a several sensors project?

Sat Jan 04, 2020 8:53 pm

You currently supply the sensors from 5V or 3.3V, not from the GPIO themselves which are only used to provide sensor status
Indeed, that's what I said :)
Basically, I know how to wire sensors with pins (GPIO and power pins). My installation works but it's not very stable: the RPi ends up not responding or retrieving wrong sensors values after requesting for all sensors values a lot of times.
What is the problem on your system with the power consumption ? Are you just afraid ? You should not.
Ok, thanks.
So I understand that, based on your opinion, my physical installation (sensors wiring) is not the cause of the system instability.
Since this is the first time I connect so many sensors to a Raspberry Pi (most of time, it's only 1 sensor), I thought the instability was due to power consumption by sensors.

Anyway, I will try to use a Raspberry Pi 4 once I'll get it and see how things go. I'll let you know.
Thanks for your help!

nomdediot
Posts: 52
Joined: Sat Feb 02, 2013 3:04 pm

Re: Which Power solution for a several sensors project?

Sun Jan 05, 2020 12:51 pm

I had some troubles and instability few days ago with my raspberry pi because I was using a chip power adapter. I just changed the adapter to solve all my issues. Which kind of supply are you using ?

However, many docker containers on your pi is also not very recommended, try simplify the software, maybe it's not an hardware issue.

pcmanbob
Posts: 7925
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Which Power solution for a several sensors project?

Sun Jan 05, 2020 12:59 pm

You should not have any problem with powering the devices shown in your diagram if you are using a good power supply like the recommended official ones ,

The pir draws around 65mA ( from 5v supply )
The DHT22 draws around 1.5mA
I cant get the link for the sound sensor to work but I would guess it would be under 10mA

So in total you probably have 77mA load from your sensors which should not be a problem for the pi to supply.

The PIR you have used is known to suffer from interference from wifi signals , so if you pi is using wifi it might be the cause of false triggers.

The DHT22 requires a pull up resistor on the data pin which you may have used but not shown , there is also a limit on how often you can read the sensor I think its recommends not to read it fast than once every 2 seconds.

So I don't see any problems with the power that could be causing any instabilities ( assuming a good power supply ), so I would look to your program for possible causes.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Re: Which Power solution for a several sensors project?

Sun Jan 05, 2020 4:38 pm

Thank you, it's very helpful!

Unfortunately, I do think that 77mA is too much for the Pi.
Based on what I read, the 3.3V pins can provide up to 50mA globally (read here):
The Pi 3.3V rail is widely assumed to provide 50mA, but this is not officially documented for recent Pi models
Unfortunately, this is not official information and it seems to depend on the version of the Pi. Plus, max power delivered by 5V pins is also not very clear...

Anyway, I think I have enough information to move forward and consider other options to have a more stable config.

Thank you!

pcmanbob
Posts: 7925
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Which Power solution for a several sensors project?

Sun Jan 05, 2020 9:25 pm

jeremy_fritz wrote:
Sun Jan 05, 2020 4:38 pm
Thank you, it's very helpful!

Unfortunately, I do think that 77mA is too much for the Pi.
Based on what I read, the 3.3V pins can provide up to 50mA globally (read here):
The Pi 3.3V rail is widely assumed to provide 50mA, but this is not officially documented for recent Pi models
Unfortunately, this is not official information and it seems to depend on the version of the Pi. Plus, max power delivered by 5V pins is also not very clear...

Anyway, I think I have enough information to move forward and consider other options to have a more stable config.

Thank you!
So first the PIR is powered from the 5V pin on the gpio header, you can draw about 1A from the 2 pins if you have a good power supply, you are drawing 65mA

So you are only drawing 11mA from the 3.3v pin on the gpio header, you should be OK up to about 50mA
( I know from another thread that 133mA drawn from the 3.3v gpio header pin will cause the pi to reboot. )

you are not drawing any power from gpio pins which are limited to 16mA per pin and a combined total of 50mA for all gpio pins,


so you should not have any problems powering your project directly from the pi gpio power header pins.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

jeremy_fritz
Posts: 66
Joined: Tue Jul 17, 2012 7:04 pm

Re: Which Power solution for a several sensors project?

Sun Jan 05, 2020 9:47 pm

Very clear!

Thank you so much :)

Return to “HATs and other add-ons”