September 2019 Update

New! We're moving to the new forum!

ALL new Blog posts will be on the forum.

Please join us there.

This Blog will no longer be updated...

Monday, August 5, 2019

More power to the sensors

As I was measuring the voltage on the arduino pins when set HIGH, I noticed I was only reading 4.2 volts when it should have been 5v. While it didn't SEEM to affect the DHT22, or my soil moisture sensors, it does make me wonder.

I've decided to add a dc-dc converter, and will take power from the Vin pin as I am powering the Mega with a 12v wall wart. The converter will be set to a true 5vdc output.  In order toswitch this power to any one sensor, I will be using S8050 NPN transistors, I've got a bunch, enough to do one module, I'll need 20, 16 for the analog ports, and 4 for the digital ports.

Luckily, I just finished (about two weeks ago) a new custom Sensor Module shield, or daughter board. Link here

This post will be updated as I make this modification and test it on this new shield.

So, let's get started...

You can see the 16 analog ports on the left side, and the 4 digital ports on the right. I call them ports because their numbering is offset by one from the pins, Port 1 is pin 0, Port 16 is pin 15. I did this because IF anyone else ever runs this, and they aren't familiar with the arduino, or programming, starting at 0 would seem weird.. so we have Port 1-16 are the analog ports, and Port 17-20 are the digital ports. The digital ports are not numbered to match the pins they use.

The red lines you see are the 5v power wires which go from the arduino digital pins to the port connectors along the edges.  The first thing I need to do is to remove them so I can rewire the board. Luckily I left lots of room at the bottom of the perfboard where I can add all the parts.

Before I even start, I have a change of plans...   Currently I plug a 12v wall wart into the Mega's power connector, and I was planning on drawing 12v from the Vin pin.  

I believe it will be better to add a connector to the shield, plug the wall wart into it, and let it power the Mega via the Vin pin. This will ensure I don't draw too much current from the arduino, I know the pins are limited to a MAX of 40ma (20ma limit suggested)   The dc-dc converter I'm adding is capable of providing up to 3A (not tested, it's cheap Chinese, so maybe not) way more than the Mega can provide. Granted, my transistors are only rated for .5A or 500ma... still way more (20X) what the Mega can provide.

I drilled three holes for the three pins of the connector. There is a positive, negative, and the third one acts as a switch when you insert a barrel connector into the outlet. The third pin is connected to ground when there is no plug inserted, and when you insert the plug, it breaks the connection. I doubt I'll use that feature, but I;'ll keep the pin in case.  The holes were made with a 1/8" bit, and you'll notice the large blobs of solder on the pins, that's because it isn't a tight fit, and the holes have removed the solder pads where the pins are, so I use a blob to make sure the pins are well anchored, since pushing the connector in will cause some stress on these solder joints.

Now for some re-wiring....

I got a little anxious there and started removing the red 5 volt wires, luckily I decided to test it first by just modifying the digital ports. I soldered a resistor and transistor in for the first port, then realized that putting the load (sensor) on the low side (powered off the emitter on the transistor) I would lose about 0.7 volts across the collector and emitter, putting me right back where I was... 4.3 volts...

In order to get the full voltage, the load must be across the high side, in other words, be powered directly from the power source, and the ground hooked up to the collector of the transistor.  This is for an NPN transistor...

EDIT: This schematic does not show the 12vdc to 5vdc module. I won't be sending 12v to the pins!

So, back to the wiring....

No comments:

Post a Comment

Any comments deemed off topic or offensive will be removed