I have a multi-sensor configuration connected to an Arduino MEGA R3. Please reference the attached Fritzing file.
The code works, but sometimes it seems to stall or hang after a few random loop cycles. I found that if I up the voltage on the buck, it will run longer and without issue. When I checked the voltage at each sensor, using the buck ground and each sensor's voltage in, I can see that some sensors (BHT11, DS18B20, HX711) had very high voltages (around 5.6 V). This having me think I am going to fry a sensor. When checking the other sensors (BNO055, ADXL345) they seemed to be right at 5 V. The GPS was a little low at 4.8 v. The DS3231 was a little high (5.4 V) and the SD Card Reader was a little low (4.8 V). The WiFi module was also low (4.5 V).
I noticed all fluctuated as the WiFi module sucked in current. So I tried adding the caps in front of each module to se it it helped. It sort of did in that each module now stays around the same voltage, but the smaller ones (DHT11, DS18B20, HS711) are getting upper side of 5.7 V while the WiFi and GPS are at lower range of 4.6 V.
I do not know the best way to even out the current so that the heavy usage modules get closer to 5 V and the smaller current modules come down.
I have all datasheets and can go look up manufacturers noted current draws for each module.
Can anyone provide some guidance and best practice approach?
The Fritzing file was blocked. Here is the jpg version of the file. Happy to provide any additional details or clarifications if this image is not detailed enough to see the connections.
As stated, it is extremely difficult to comprehend a design by the wiring diagram. A schematic is needed AND the schematic should be drawn according to some basic tenets.
A question regarding your software. Are you using any interrupts?
Questions regarding your hardware:
How long are the wires to the sensors?
do you have grounds running in series? i.e. ground goes from the power supply to the arduino board to sensor 1 then sensor 2 etc. Grounds should be in a "star" configuration. i.e. power goes from the supply to the arduino board and from that same point on the arduino board grounds go off to each sensor and component.
Probably a wiring and or breadboard problem as they are not designed for more than a few hundred milliamperes of current.
If you have a DMM (digital multimeter) you can verify the power distribution. Put the meter on DC and the black lead on the negative of the power source. Not on a wire somewhere but right at the source. Now with the positive lead, measure the GND lead at each sensor. Yes, the ground connection. If you see more than about 20 millivolts (0.02 volts), your power wiring is the problem with high resistance causing high voltage drops. As mentioned in the previous post, anything that requires more than a few milliamperes of supply current should be wired in a star or parallel fashion, not serial, or device to device chaining. A breadboard is in fact a series of series connections.
Also, measure the power supply right at the supply terminals, if it is 5.7 volts, you need a new supply.
Hi,
The bypass capacitors are a very good idea with such as wire intense layout.
How ever one of the biggest problems will be the protoboards themselves.
The connections are not always perfect and if you daisy chain the boards together power supply wise like you have, then supply levels may not be stable.
In your case I would suggest you have each gnd and each 5V connection from each board connected to the DC-DC converter in a star layout.
At the moment you have sensors sharing supply current wires and connections, where as each sensor connected directly to the DC-DC converter would be a better solution.
A proper schematic would also make following signal and power flow a lot easier along with component and pin labels.
You probably have cheap hook-up wires or a stretched socket somewhere on one of the breadboards,
leading to too much resistance somewhere in the power or ground distribution.
The fact you have 5V somewhere and 4.8V somewhere else in the power distribution is a strong
indicator of poor connections or cheap wires.
I tend to use 0.6mm solid-core wire for breadboard use as it can carry lots of current without the
slightest issue.
Premade crimped dupont wires can vary a lot in quality, some have so little copper that the crimping
doesn't always make good contact. Basically such wire isn't a wise choice for power connections.
Also you have many wiring links daisy chained across the breadboards, meaning lots of connections
have to be solid and low-resistance for it to be reliable.
Its much better to distribute the power and ground wiring in a star from one point, so that there's no
daisy-chaining - breadboard contacts are not always great, and each contributes some contact resistance.
Thanks all, especially Tom. Good advice all. I will work on a schematic. This thing grew over time as requirements mounted. So I will step back, document properly, and update the design per suggestions.
I will also go to soldered connections and following the star connection advice. That was the intent but obviously missed the mark.
I am not using interrupts.
I am using good quality wire. I am using proto-boards. The advice to remove the protoboards makes the most sense from all the responses. I have also seen the boards give strange results due to bad connections during other projects that also used the same type of proto-boards.
I will post the results as I complete them.
One follow-on question...I have I2C, SPI, and regular digital connections. If I move to soldered connections, is 5 inches too long for the I2C or SPI wires? The SPI is a shared bus, so is there a best practice for connecting multiple SPI modules to one SPI bus? Right now I have each extended a little (about 3 inches over to the bread board), then split to each device (about 2 more inches).
Ironically, the devices that are on the I2C bus seem to work fine. Even the GPS has been rock solid. Only the WiFi module seems to pull/spike current utilization and drop out, while the other devices stay high (some being/seming too high).
Is your buck regulation stable ?
If the voltage on the buck is 5.00V at the exact moment the voltage on a sensor is 5.5V I would have to wonder
where the other 0.5V came from ? How is that even possible ?
It is not possible. What I was doing was upping the buck to around 5.6 or 5.9V to get the other end devices to be close to 5V. This had the affect of over voltage on the smaller sensors; putting them over the 5V.
When running all breakouts and sensors at once, especially when the WiFi breakout pulls a lot of current, the WiFi would go below its threshold (below around 4.5V) and reboot or stall. But the others would be way above the 5V.
I am going to revisit the above recommendations from these posts and see if I can do a better job with the layout. Starting with the schematic should help.
"It is not possible. What I was doing was upping the buck to around 5.6 or 5.9V to get the other end devices to be close to 5V. This had the affect of over voltage on the smaller sensors; putting them over the 5V."
"
I do not know the best way to even out the current so that the heavy usage modules get closer to 5 V and the smaller current modules come down."
This makes no sense and tells me that you are
mismanaging your solution by implementing
countermeasures for conditions which would not exist in a well designed system. What you are doing would not be done by someone who
understands the problem.
Your buck regulation is not good enough or your wires are too small. A good 5V supply reads 5V everywhere. The fact that you are adjusting the
buck over 5.05V says tgat you don't understand
this fact. I've worked with electronics for 40
years and have never had to do that. I just use
a 5V supply that is properly rated and wires
properly sized. Measure alll the voltage drops from your Buck to each device after adjusting the buck for 5.05V. Then post the following info for every device:
Device name
rated current
wire length from buck
voltage drop across wires
wire guage of wires
voltage at buck
voltage at device
If possible, measure device current
Method of connection:
a. Is it connected to a solderless breadboard ?
b. are there crimped wires such as Dupont
jumpers ?
If you google TTL you will fiind the allowable
voltage range for 5V logoc is 5.00V (+/- 0.5V)
If you take the device with the largest voltage
deviation and remove all the poor connections
by replacing them with soldered and increase
the wire guage to double or tripple thickness
or double or tripple number of wires for both
positive and negative , you should see a big difference. I still suspect the buck regulation
but to confirm that you would need to replace it with a 5V supply rated for three times your maximum load and set it for 5.1, 5.2, or 5.3V.
Your voltage drop is most likely caused by using wires that are too small which are acting like resistors. Replace all the connection wires with wires twice as thick or double the wires (2 pos, 2 neg) and Reduce the buck to 5V
or get a proper 5V supply. Your problems are not electronics. Your problem is lack of experience with electronics and trying to cut corners. Buy a good 5V
supply that is rated for your load and get rid the buck and double your wire thickness.
I do not see a link for the buck posted anywhere.
Please post a link for the buck converter.
It is not possible. What I was doing was upping the buck to around 5.6 or 5.9V to get the other end devices to be close to 5V. This had the affect of over voltage on the smaller sensors; putting them over the 5V.
When running all breakouts and sensors at once, especially when the WiFi breakout pulls a lot of current, the WiFi would go below its threshold (below around 4.5V) and reboot or stall. But the others would be way above the 5V.
If you are using plugin protoboards and the dupont jumpers sold on Ebay, Amazon then you are always going to have wire issues. I've found jumpers that were poorly crimped, wire that was not copper (copper clad ferrous metal, was magnetic) etc. At least for power and ground you should consider alternate wiring.
I use my own dupont jumpers (made using a kit purchased on ebay) or else I will remove the crimped pin from the plastic housing (carefully) solder the at the crimp and reassemble. I will not use any wire that can be attracted to a magnet.
raschemmel:
I would be willing to bet that China MFGs are buying scrap metal and melting it down to make wire and your dupont jumpers were once somebody's car.
A job for a magnet. Is it copper or a Cooper (mini)?
Have been working on improving the configuration based on everyone's advice.
First, here is the schematic. I still used fritzing since it is free, but at least it is the schematic view and not the breadboard view.
I have started using screw terminals so I can reuse the modules over time. I have also tried to reduce the overall length of the wires per suggestions.
I am still waiting on a few parts, but when they arrive and I get it wired back up, will send a photo to go with the schematic.
In the meantime, any additional suggestions are welcome. I heard from one person who stated home running the I2C bus is not a good idea, so thinking of fixing that first. Other suggestions, like home running the power for the WiFi module and SD Card Reader but daisy chaining the other smaller components are next on my list.
raschemmel:
I would be willing to bet that China MFGs are buying scrap metal and melting it down to make wire and your dupont jumpers were once somebody's car.
And you think that US manufacturers don't melt down scrap metal to make wires and jumpers?
Thank you for the advice to-date. A suggestion I took to heart was making a real schematic, not a Fritzing diagram.
Please see the attached schematics. There are two versions of the same thing. One is using an Arduino MEGA and the other an ESP32. For the purposes of this thread, please reference the Arduino MEGA.
Back to my original question: How to ensure the circuit is balanced, based on added resistors and known values of the Arduino MEGA?
While waiting on responses, I will be wiring up the above and taking some photo's for posting here.
The original thread was about voltage drop problems with solderless breadboards and jumper wires. If the physical construction has not changed, our earlier posts are still applicable.
How to ensure the circuit is balanced, based on added resistors and known values of the Arduino MEGA?
Resistors added where? For what reason? You don’t fix voltage drop problems with resistors, you eliminate them with proper construction techniques.
Thank you for the response. I did not "add" resistors. My fault for using poor wording. The resistors in the schematic are what I was attempting to reference. They are outside of the modules and Arduino MEGA, so that is the "added" circuitry. They support the red and green LEDs, and a 10K for the CD on the SD card reader module.
Still wiring up. Hope to have photos some time in the next day or so.