Max's Arduino Mega and chipKIT Max32 both require 9V external supplies, but he really wishes to power them from a single 5V supply.
Now, we want to drive the Arduino Mega from an external 5V supply. Even if diode D1 has a voltage drop of only 0.3V, this is still too much, so we are going to short it out. Next, we are going to remove voltage regulator IC1 and connect its input (pin 3) to its output (pin 2). This means our 5V supply is now connected directly to the +5V rail.
But now we have a problem. We are now feeding 5.0V into the resistor divider, which means the CMP signal will be only 2.5V. This is less than the value on the +3V3 rail, which means the comparator IC7B will turn transistor T1 on, thereby allowing the USBVCC supply to drive the +5V rail as well. In order to get around this, what we're going to do is to solder a 5.6K resistor in parallel with the upper resistor in the network.
Ivan further noted that he picked a value of 5.6KΩ because he happened to have some of these resistors handy. Also, that we had to solder this on top of the upper resistor, because both of these resistors were presented in a four-resistor pack. So what we now have is a 10KΩ resistor in parallel with a 5.6KΩ resistor. Using the formula RP = (R1 * R2) / (R1 + R2), this gives us a combined resistance of ~3.6K. In turn, when our 5V supply is now used to drive the resistor divider network, the CMP signal will be ~3.7V. This is higher than the +3V3 signal, so the comparator IC7B will disable transistor T1. Et voila! (Ivan didn’t actually say Et voila! But I could hear it in his voice.)
Suiting his actions to his words, Ivan went on to make the changes to my Arduino Mega as illustrated below. As soon as he'd finished, we tried powering the board only from my 5V supply. Everything worked perfectly. (Hurray!) Next, we tried powering the board only from the USB cable. Once again, everything worked as expected. (Double hurray!)
Finally, we connected the board to both the 5V power supply and the USB cable. As we expected, the CMP signal was high enough to cause comparator IC7B to disable transistor T1. (Triple hurray!)
Ivan also noted that there's one thing to be careful of here. If the 5V power supply is connected to the board, then it must also be plugged into the wall before one connects the USB cable. This is because we removed diode D1. If the 5V supply is connected to the board but it's not plugged into the wall, then when the USB cable is connected it will back-drive the power supply. The resulting current surge might cause the USB port to turn itself off, which wouldn’t be a disaster, but would be jolly annoying.
Modifying the chipKIT Max32
Our next step was to take a look at the PDF schematic diagram for the chipKIT Max32. Once again, you can access the entire schematic by clicking here, but the relevant portions are shown below.
Subset of the chipKIT Max32 schematic diagram.
(Click here to see a larger image.)
The external power supply enters the upper left-hand side of the schematic via connector J2. By default, jumper JP1 is set to connect pins 2 and 3. This means that the external supply is fed to diode D2. The output from diode D2 feeds the input to the voltage regulator IC4, the output of which drives the VCC5V0 rail. This rail is fed to voltage regulator IC3, the output of which drives the VCC3V3 rail.
In the bottom right-hand corner of the schematic we see a comparator IC5G1. The output from this comparator is used to control transistor Q1. In turn, this transistor either enables or disables the USB5V0 supply coming from the USB cable.
In this case, it looks as though the designers of the chipKIT Max32 have largely anticipated our needs. At first glance, it would appear that all we have to do is move jumper JP1 such that it connects pins 1 and 2 instead of 2 and 3. This simply bypasses diode D2 and regulator IC4, and connects our external 5V supply directly to the VCC5V0 rail.
Sad to relate, however, there is a small "gotcha." Note the resistor divider network formed from resistors R13 and R14 in the upper left-hand corner of the schematic. This is similar to the Arduino Mega. The VCMP signal from the resistor divider is used to feed the input to comparator IC5G1.
There won’t be any problem if we use only our external supply to power the board. Similarly, there won’t be an issue if we use only the USB cable to power the board. The problem arises if both the external supply and the USB cable are plugged in at the same time. In this case, our 5V supply being fed into the resistor divider will leave VCMP at 2.5V, which means transistor Q1 will be turned on and the 5V supply coming through the USB cable will end up fighting our external supply.
If only the designers of the chipKIT Max32 had thought to provide another jumper allowing us to change the value of R13, but they didn't (sad face).
When you are in a prototyping situation, you very often want to connect the USB cable to tweak your program. Now, I could make the decision only to have the external supply or the USB cable plugged in at any particular time. With the best will in the world, however, I'm sure I would forget. As before, the solution is to solder a 5.6KΩ resistor in parallel with resistor R13 as illustrated below:
Once again, we tested the result first with the 5V external supply on its own, then with the USB cable on its own, and finally with both the external supply and the USB cable plugged in. In all three cases, everything worked as planned (happy dance).
So, there you have it. I'm now able to power my 256 LEDs, my Arduino Mega, and my chipKIT Max32, all from the same 5V 26A supply. All I have to do now is finish my BADASS display…
- Creating an Inamorata Prognostication Engine, Part 1
- Creating an Inamorata Prognostication Engine, Part 2
- Creating an Inamorata Prognostication Engine, Part 3
- Ultra-Macho Prognostication Engine, Part 1
- Video: Vacuum Tubes Lit With Tri-Colored LEDs
- Building a Mind-Boggling Infinity Mirror, Part 1
- Building a Mind-Boggling Infinity Mirror, Part 2
- Building a Mind-Boggling Infinity Mirror, Part 3
- Max's BADASS Display, Part 1
- Max's BADASS Display, Part 2
- Max's BADASS Display, Part 3
- Max's BADASS Display, Part 4
- Max's BADASS Display, Part 5
- Should the Golden Ratio Be Used in Industrial Design?
- Linking 2 MCUs: I2C, SPI, or a Home Grown Interface?
— Max Maxfield, Editor of All Things Fun & Interesting