Hello, I am currently carrying out an internship assignment where I have to automate a door for a solar-powered chicken coop.
Currently, I have carried out a test setup with the help of an Arduino UNO board, a solar cell, an LCD display (stacked on a prototype shield board made by my internship supervisor), a 3.7v lipo battery of 1200 milliamperes per hour, 2 resistors of 330k Ohms, and a rectifier diode.
I made an assembly where the Arduino UNO measures the voltage at the terminals of the solar cell, which emits a different voltage depending on the level of luminosity detected, and the voltage in question is displayed on the LCD screen thanks to the lcd function .print.
I used this diagram that my internship supervisor advised me to measure the voltage of the solar cell:
Note that the rectifier diode allows the lipo battery to avoid discharging.
Here is the assembly I made:
I'm measuring the voltage with analog pin A1, and all the Arduino UNO pins needed to run the LCD display (D4, D5, D6, D7, D8, D9, D10, 5V, and GND) are connected via the green jumpers on the shield where the LCD Display module is stacked.
We can also notice that another GND pin of the Arduino connected to the ground of the solar cell.
I then program the Arduino with this program which consists in displaying the measured voltage on the LCD screen:
// LCD Keypad Shield
#include <LiquidCrystal.h>
// Création de l'objet lcd (avec les différents ports numériques qu'il utilise)
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
// Variables
int lcd_key = 0;
int adc_key_in = 0;
// Constantes
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5
void setup()
{
lcd.begin(16, 2); // Démarrage de l'écran
lcd.setCursor(0,0); // Positionnement du curseur au début
lcd.print("Mesure tension"); // Message
}
void loop() {
lcd.setCursor(0,1); // Positionnement du curseur début de ligne 1
lcd_key = read_LCD_buttons(); // Lecture des touches
// Mesure la tension sur la broche A1
int valeur = analogRead(A1);
// Transforme la mesure (nombre entier) en tension via un produit en croix
float tension = valeur * (5.0 / 1023.0);
// Affiche la mesure de la tension sur l'écran LCD et attends 500ms
lcd.print(tension);
lcd.print("V ");
delay(500);
}
// Fonction de lecture des touches
int read_LCD_buttons()
{
adc_key_in = analogRead(0); // Lecture du port analogique
// Les valeurs qui suivent doivent être adaptées au shield
if (adc_key_in > 1000) return btnNONE; // En principe 1023 quand aucune touche n'est pressée
if (adc_key_in < 50) return btnRIGHT; // 0
if (adc_key_in < 195) return btnUP; // 99
if (adc_key_in < 380) return btnDOWN; // 255
if (adc_key_in < 555) return btnLEFT; // 409
if (adc_key_in < 790) return btnSELECT; // 640
return btnNONE;
}
The program runs smoothly, with the text displaying the voltage appearing on the screen without issue.
However, you can observe in the diagram that the assembly is powered via the USB port of the Arduino board which is connected with my laptop.
Instead, I want to power my Arduino board with another source so that I can test my hardware outdoors without carrying my computer around all the time.
So, I tried to modify the assembly by unplugging the USB port and placing another lipo battery across the solar cell, and also connected with the 5V and GND of the Arduino.
However, by powering my assembly, the LCD screen lights up, but the text does not appear.
After several tests carried out, it seems to me that the text only appears if the LCD display is powered by a voltage of 5V. No ?
Could someone tell me how to fix the problem? What kind of editing would you suggest to me?
Thanks in advance if anyone answers me.







