Using 40 sensors on Arduino Mega 2560 R3

Hello!

I am planning on using 20 ultrasonic distance sensors with 20 passive infrared motion sensors on Arduino Mega 2560 R3.

If I am not mistaken, the Arduino Mega 2560 R3's built-in power supply cannot handle all 40 sensors together. I am planning to use a 12V 20A external power supply β€” as this is the only available supply that I have. I will use a 12V to 5V buck converter to achieve the required 5V supply voltage for both the HC-SR04 Ultrasonic Sensor and the HC-SR501 PIR Sensor, but I have a few concerns.

[1] The power supply I have provides 20A of current. If I use a buck converter that outputs a max of 3A, will it be okay on its own (without any current-limiting resistor)? If I need to limit the current, how shall I modify the circuit?

[2] According to the datasheet, the ultrasonic sensor's operating current is approximately 15 mA, while the PIR needs around 65 mA. I don't know if I did the math correctly, but I just divided 3 A by 40 sensors which yields 75 mA for each. Is this correct? If yes, is there a way I can limit the current passing through each sensor around its safe levels?

At thrift shops and computer recycling outfits, you can pick up discarded but fully functional laptop and monitor power bricks or 5V phone chargers for next to nothing. Power everything (including the Mega) from a 5V supply and you don't need the step down converters.

20 x 15 mA + 20 x 65 mA = 1.6 Amperes, so a 5V, 2A power brick or phone charger will handle everything with ease.

1 Like

Make that 20 * 15mA + 20 * 65uA = 300mA.

Shouldn't be a problem for a Mega on USB power, or powered with a cellphone charger on the USB socket. That 15mA is likely only used during transmit, and is normally 2mA. You can only use one HC-SR04 at the time anyway, because of echoes.
Leo..

That did sound awfully high, but I did not bother to check.

It will be interesting to see how you handle all of the sensors and in what time frame that would be. The HC-SR04 sensors will hear each other as well as themselves unless properly spaced.

I am proposing a seat occupancy monitoring for my capstone project, and I have plans on proper seating layout as well as setting a threshold for the ultrasonic sensors' distance detection 🫢🏻

I'm pretty certain I could pull this off, as I was able to do this for three ultrasonic sensors simultaneously. I just need help on some aspects of the 20-sensor upgrade, such as the issues I presented above.

Was it too high? I was also wondering why the ultrasonic and PIR sensors didn't have almost the same level of working current... Would've been better if both operated at around 15 mA, and I'd have no worries with the power supply and circuitry.

Hello! Upon checking the datasheet, it really said 65 mA working current. However, I read at another forum topic that the data there may be incorrect, and that static current consumption of the PIR is indeed around 50 ΞΌA. This removes some of my worries. Does this mean I could power all the sensors together via the Arduino Mega 2560 alone?

You bettor make sure.
Workng current and static current are two different things.

2 Likes

Rephrase.

The power supply I have provides up to 20A of current, depending on load demand.

99.99 percent of regulated power supplies on the market today regulate their voltage output to some fixed number, and provide as much current as the load requires, up to the stated maximum output current. So in your case, your loads are tiny in relation to the available current; if the voltage is acceptable to the loads, you're good to go.

In the case of your buck converter, again, it will provide a regulated voltage and a current between 0 and N amperes, depending upon the load characteristics. Again, sounds like you're good to go.

But yes, that power supply I would only use in extremis. There's a plethora of small wall-wart and table-top supplies out there that will do this job, supplying a voltage from 9-24 volts at some current to your buck converter.
Hope that helps.

As for using your Mega as a power supply, while convenient, I would ask myself, "well, if I damage it, how would the replacement cost/time/bother affect my project, as opposed to spending a few bucks on an external power source, and not having the risk". YMMV.

Interesting. How are you planning on doing this? When I saw those sensors I first thought you were going to do an over the top burglary alarm.

For seat occupancy I'd probably be looking at other sensors, such as an FSR to detect when someone is sitting in the seat (i.e. there's additional weight).

I have been working with Arduinos for many years and these are the major rules I have learned to live by.

My Crispy Critter Rules:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive to an Arduino!
Violating these rules tends to make crispy critters out of Arduinos.

2 Likes

Bit extreme.
Maybe better to teach newbies what the limitations are, instead of just scaring them away.
Powering sensors and LEDs, within the limitations, is what the Arduino is designed for.
If not, it wouldn't have a 5volt and/or 3.3volt pin.

And if you do it wrong... Magic smoke is a very good teacher.
Leo..

1 Like

Thank you for this! I'd stick to my buck converter then :>>

Maybe better to teach newbies what the limitations are, instead of just scaring them away.

It's okay! Totally fine, I won't get scared easily as I need this for my grades ahahahah.
`

The ultrasonic senses the distance of something within its range, right? If there's distance, then something is present. I'd set a threshold distance that's optimal for a seat, and whenever an ultrasonic detects something, I'd update the monitoring system in real-time. Since we can't verify if the occupant is a human or just a random obstacle, I'd have the PIR sensor ready for verification purposes if there's human motion. The motion need not be continuous, it just needs to be present from time to time (no human can stay completely still for a long time unless asleep, and even sleeping people move from time to time).

For seat occupancy I'd probably be looking at other sensors, such as an FSR to detect when someone is sitting in the seat (i.e. there's additional weight).

I was actually thinking of a camera or weight sensor as those are the obviously better options, but to be perfectly honest, we shifted from another capstone project to this, just recently. As a beginner Arduino enthusiast, I found that the programming, as well as the hardware requirements for the camera or the weight sensors are well out of my capabilities. The ultrasonic and PIR sensors have a relatively easy code and wiring, so I was forced to stick with it, given the very little time I have (the prototype presentation is in two days).

Thank you for your inputs! It helped me through the very last minute :>>

Problem is they for the most part to not appear to understand the terms. The complicated ones like volts and amps they get after a few units have been damaged.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.