Hello,
I'm using an Arduino UNO, and im trying to control a simply 5V solenoid. When I stick the solenoid into the VCC pin of arduino, it pops as expected but when I do the same with an I/O pin the solenoid doesn't seem to react.
I have used a multimeter to measure that the VCC and my I/O pin both give off ~5Volts but the VCC pin sources way more current (actually when i measure current, the arduino seems to disconnect from my computer).
So I'm assuming that this lack of current from the I/O pin is the problem - is there a way to increase current output in code?
Or is there a work around without having to build some external board?
If you connected the solenoid without using a flyback diode you may have
damaged the Arduino permanently.
You must never drive an unprotected inductive load from a semiconductor device,
inductors will kick back with 100's or 1000's of volts if you switch them off suddenly
without providing an alternate current path.
When driving from the Vcc the large decoupling capacitors on the supply will probably
provided enough of a path to protect the board, but when you connected to the output
pin you'll have forced the current through a single protection diode rated at 1mA or
perhaps less.
actually when i measure current, the arduino seems to disconnect from my computer)
The USB circuitry in the PC is current protected and the "disconnect" is the 5Volts being disconnected until the overload us removed.
Use a blink LED sketch to verify that the Arduino pin, specific to your experiment with the solenoid, still functions correctly.
You will definitely need an external power supply for the solenoid - only the Ground connection will be common to the Arduino. Bipolar transistors are current amplifiers, so even with this may not be acceptable for your solenoid circuit: the Arduino pin would need to supply the load current max divided by the transistor gain and if this is greater than 40mA you are min the danger zone... MosFET is a better approach: small boards are made specifically for the Arduino to drive heavy loads. SparkFun MOSFET Power Control Kit - COM-10256 - SparkFun Electronics (buy MosFET separately.)