# Controlling Voltage and Current

#### CivicCritical

Joined Oct 12, 2018
5
For school, I need to design a circuit that can provide power at appropriate current and voltage to charging devices (and also incorporate an LCD and Arduino board). I am studying mechanical engineering but hey, first year and I am absolutely terrible with electrical.

I have a DC power supply of 12W: 5V & 2.4A. I need to drop the voltage by approximately 0.65V to 4.35V to charge a 4.2V device. I was planning use a resistor and then a switch that would add another resistor when desired to achieve a further drop to 3.7V. I am unclear on how to control voltage and current at the same time.

I was thinking for the first voltage drop that a resistor of 0.27Ω would cause a drop of 0.65V. Vdrop = 2.4A * R = 0.65V so R = 0.65V/2.4A.
I'm not really sure where to go from here or if this is wildly wrong. Any help would be appreciated.

Thanks,
James

#### ebp

Joined Feb 8, 2018
2,332
4.2 V sounds very like a single lithium ion cell. It is absolutely imperative that lithium cells not be overcharged by more than a very small amount or there is a risk of them exploding or catching fire. If they are overcharged to a less degree, the life, in terms of number of charge-discharge cycles, can be dramatically reduced.

A resistor won't do for this sort of application because, as you calculate, the voltage drop is dependent on current, but not the current that the supply can deliver, rather the current that the load requires. If you are charging a battery, the current will drop as the battery approaches full charge, meaning the voltage at the battery will go up. The 2.4 A rating of the supply is probably the specified maximum load, but the supply might be able to deliver much higher current at rated voltage or with the voltage dropping somewhat if you overload it. Most power supplies do not have accurate current limiting.

You need to tell us a bit more about what you are trying to do.

#### CivicCritical

Joined Oct 12, 2018
5
The assignment is to create a circuit powered by a DC supply that is capable of charging 2 different handheld radios of our choosing. The DC supply must be portable, so i chose a 5V/2.4A power bank. Our materials provided were a breadboard, arduino, LCD to display voltage and charge %, resistors, wires and potentiometers. I don't see how I can achieve an acceptable current and voltage for one radio, let alone 2. I also don't see why 1000 Ohm potentiometers would be used as it would be much harder to control resistance.

I have attached a Fritzing diagram of my circuit. The LED goes green when charge is over 75% and red under. The LCD displays charge% and voltage.

I was introduced to Arduino a few days ago and I am sure there's a lot wrong. This is the Arduino code so far:

C:
/*
* the program detects the voltage across a resistor and displays the result both on the Serial monitor and a LCD
*/

// include LCD library and I2C library
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x20 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x20  , 16, 2);

void setup() {
lcd.begin();
lcd.backlight(); // lcd.noBacklight() will turn off the light, lcd.backlight() turn it on

lcd.setCursor(5,0); // set cursor to the 5th char of the 1st line (row number starting at 0)
lcd.print("James");
lcd.setCursor(3,1); // set cursor to the 3rd char of the 2nd line (row number starting at 1)
lcd.print("s4582287");
delay(2000);

pinMode(5,OUTPUT);
pinMode(6,OUTPUT);

Serial.begin(9600); // Initialize the serial monitor at a speed of 9600 baud
}

void loop() {
int sensorValue = analogRead(A0); // read the input on analog pin 0
float voltage = sensorValue * (5.0 / 1023.0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V)
float percentage = 1-voltage/5;
Serial.print(voltage); // print out the value you read
Serial.print("\t"); // print out the value you read
Serial.println(percentage); // print out the value you read

// display messages on LCD
lcd.clear();
lcd.setCursor(0,0);
lcd.print("voltage:");
lcd.setCursor(8,0);
lcd.print(voltage);
lcd.setCursor(0,1);
lcd.print(100*percentage);
lcd.setCursor(5,1);
lcd.print("% full");

if (percentage<0.75) // if low battery, turn the red LED on
{
digitalWrite(6,HIGH);
digitalWrite(5,LOW);
delay(1000);
}
else // if normal, turn the green LED on
{
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
delay(1000);
}
// add other useful features here
}
Moderator edit: added code tags.

#### Attachments

• 271.1 KB Views: 3
Last edited:

#### BR-549

Joined Sep 22, 2013
4,928
Do the "2 different handheld radios of our choosing" use the exact same battery?

#### CivicCritical

Joined Oct 12, 2018
5
Do the "2 different handheld radios of our choosing" use the exact same battery?
I wish, they want us to use different batteries.

#### BR-549

Joined Sep 22, 2013
4,928
Maybe I am not on your page yet.........what types of batteries? what are the voltages?.......and who asked you to do this?

I don't think I understand clearly what are your parameters?

#### CivicCritical

Joined Oct 12, 2018
5
Maybe I am not on your page yet.........what types of batteries? what are the voltages?.......and who asked you to do this?

I don't think I understand clearly what are your parameters?
We must choose 2 radios using 2 different voltage batteries. I know lithium ion are more complex in their charging but it seems like most handheld radios are lithium ion. I was planning on using a 3.7V and 4.2V but they can be any voltage handheld radio. This is an assignment for first year engineering design. It definitely feels overwhelming (I am yet to do the engineering fundamentals course that introduces electrical).
For the assignment, we must create a circuit capable of charging 2 different handheld radios of different voltages (our choice) using a portable power supply of our choice. We must use an arduino board and breadboard with an LCD display to show voltage and %charge on battery. It only needs to charge 1 battery at a time.

PS. I'm probably more lost than you.

#### BR-549

Joined Sep 22, 2013
4,928
OK...I'm still in the dark. I'm not a power fella anyway. There are experts on here that can help. I have never heard of a "universal charger". But it's hard to keep up with it all. For all I know, they might have software that can sense and detect battery now.

I'll standby and let your thread cook a while.

#### CivicCritical

Joined Oct 12, 2018
5
OK...I'm still in the dark. I'm not a power fella anyway. There are experts on here that can help. I have never heard of a "universal charger". But it's hard to keep up with it all. For all I know, they might have software that can sense and detect battery now.

I'll standby and let your thread cook a while.
Great, thanks for your help

#### MrChips

Joined Oct 2, 2009
27,168
You cannot set the voltage and the current at the same time. To do so would violate the fundamental law of electricity, Ohm's Law.
For a given voltage, the current will be I = V/R.
If you set the current, the voltage will be V = I x R.
The voltage and current are interrelated by the load or resistance of the battery being charged.

#### Bordodynov

Joined May 20, 2015
3,013
The easiest way is to make a voltage regulator 4.2V and limit the current by the resistor. Suppose you want the maximum charge current not to exceed 500mA, then the value of the resistor Rb = (4.2V-2.7V) /0.5A=3Ohm. Such a charger will charge the battery for a long time, but there is no need to control the charging process. In addition, to prolong battery life, it is not recommended to charge it 100%.
But if you need a fast charge, then you can make a current generator on the operational amplifier and a P-channel transistor, and also supply it with a voltage of 4.2V.