Tell arduino if volts = < 12

Hi I am working on a project where I have a bunch of sensors. I want a way to tell the arduino that if the voltage from the power supply is less than 12v, tell 3 motors to run. (actually its a water pump, a oxygen pump and a micro servo) but the code for 3 motors will do as I only wanna understand the volt command.

I have figured out the circuit. I want to tell the arduino, if the voltage from power supply (I supplied via the Vin pin) is less 12v, just run those "3 motors" but dont run the rest of the sensors.

This is what I did, I'm sure there's a lot of mistakes (1st timer), But this is the main idea

Which board are you using?

An Arduino Uno Rev3

Please post the schematic so we're not completely in the dark.

Please do not supply more than 20V as mentioned in spec sheet.

Then have a look at this guide that clearly describes how to measure the voltage.

1 Like

sorry, will do right away.


Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring. Give links to components.

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

I've given the schematics, but really sorry I haven't done the code yet. I just copied a bunch of codes from tutorials for the sensors I used.
Would you still like to see it ? -it's really a mess.


You cannot power servos from the 5v pin of an Arduino.

Use an external 5v power supply for servo power; the Arduino GND and external power supply GND connected.

Please expand the pump wiring in the schematic so we can see how they are controlled; relay/transistor etc.

Give links to components

I don't really understand, is the 5v not enough ? So since I powered the arduino with 20v (via the solar panels - which goes thru a 20v regulator 1st ofc) can I remove the 5v supply, directly connect the breadboard to the vin and gnd? would that work ?

Also I don't know how to control the pump. Can't I directly connect it like that?

will give links..

The safe allowable current you can take from the Arduino 5v pin is very small.
The Arduino is not a power supply for high current loads.

5v devices require 5v.

Reduce the voltage to the Vin pin of the Arduino down to 10v.

But I need a total of 19.1v approx. (excluding the 2 water & oxy pumps). The limit of volts in the arduino is 20v - so it should be fine right? and I just realised the Vin is an input. How can I power the breadboard with more than 5v to be enough for components on the breadboard?

and the links ill give tmr, i have to find the sensors again..sorry

If you supply 20v to the Arduino Vin pin, the voltage regulator on the Arduino will get very hot if you take too much current from the Arduino 5v pin. You can damage the Arduino if the regulator fails.

Since you have the two solar cells powering the Arduino only, there is no need that they need to be 20; use 10v on the Vin pin.

What do you mean 10v on the Vin pin? Supply only 10v to it right ?

If I'm right, what about the 19.1v that the breadboard components need?

I don't understand the 10v on the Vin pin, sorry.

Connect a 10v solar cell to the Arduino Vin pin and Arduino GND pin.

Your 20v is overkill.

Read the sensor data sheet to find out how to properly power them.

Normally in a situation like this, the solar cell charges a battery and that battery is used to supply power to the Arduino.

You can feed the battery to a DC to DC converter who’s output then powers the Arduino.

I took all the minimum input voltage from all the sensors:

  1. Micro servo - (3-6v DC) / 10 mA
  2. Water flow sensor ( 5- 24 DC ) / 5 mA
  3. Water temperature sensor ( 3-5v DC ) / 1.5mA
  4. pH sensor ( 3.3 -5.5v DC) / 5-10 mA
  5. HC-05 bluetooth module (1.8-3.6v DC) / 5 mA
  6. Water pump (6-12v DC) -not on breadboard / 0.5 -0.7 A
  7. Oxy pump (6-12v DC) -not on breadboard / 0.5-0.7 A
  8. Temp & Humidity sensor (not added in schematics , but is on breadboard) - (3.5v DC ) / 2.5 mA

So minus the oxy & water pump = 19.1v DC

How can I choose a proper power supply ( like a solar panel --> battery ---> arduino ) like u said? that wouldn't be overkill?

It's impossible to say, without knowing what the device is used for.