Sommario:

Voltmetro preciso con display Waveshare E-ink (0-90 V CC) con Arduino Nano: 3 passaggi
Voltmetro preciso con display Waveshare E-ink (0-90 V CC) con Arduino Nano: 3 passaggi

Video: Voltmetro preciso con display Waveshare E-ink (0-90 V CC) con Arduino Nano: 3 passaggi

Video: Voltmetro preciso con display Waveshare E-ink (0-90 V CC) con Arduino Nano: 3 passaggi
Video: Waveshare E-ink Display Precise voltmeter (0-90v DC) with Arduino Nano - Code included 2024, Novembre
Anonim

In questo Instructable, utilizzo un display Waveshare E-Paper da 2,9 pollici con un Arduino Nano, un partitore di tensione e un ADS1115 per visualizzare tensioni precise fino a 90 volt CC sul display E-Paper.

Questo istruibile combina questi due progetti precedenti:

- Voltmetro Arduino (0-100V DC) - Versione 2 -

- Aggiornamento parziale del display E-Paper con Arduino -

Forniture

Materiali di consumo utilizzati:

1 x Arduino Nano -

1 x display Waveshare -

Tagliere e fili -

Banca di alimentazione USB -

1 x ADS 1115 - ADC a 16 bit -

1 x 1/4W (suggerisco di usare resistori da 1W però) 1% Resistori - 690k ohm -

1 x 1/4W (suggerisco di usare resistori da 1W però) 1% Resistori - 10k ohm -

Astro AI DM6000AR -

Batterie 9V -

CanadianWinters partecipa all'Amazon Services LLC Associates Program, un programma pubblicitario di affiliazione progettato per fornire ai siti un mezzo per guadagnare commissioni collegandosi ad Amazon.com e ai siti affiliati. Utilizzando questi link, come Associato Amazon guadagno dagli acquisti idonei, anche se acquisti qualcos'altro, e non ti costerà nulla.

Passaggio 1: colleghiamo i componenti

Colleghiamo i componenti
Colleghiamo i componenti

Ho collegato i componenti come segue:

Visualizzazione della condivisione delle onde:

Visualizza Arduino

OCCUPATO G7

RST D8

DC D9

CS D10

DIN D11

CLK D13

GND GND

VCC 3.3V

ADS1115:

ADS1115 Arduino

VCC 5V

GND GND

ADDR GND

SCL A5

SDA A4

AIN0 Partitore di tensione

Per il partitore di tensione ho usato una resistenza da 680Kohm e una da 10Kohm questa volta. Misuro sempre i valori di resistenza per una migliore precisione.

I calcoli per il partitore di tensione sono disponibili in questo foglio di calcolo che automatizza i calcoli nel caso in cui si desideri utilizzare valori di resistenza diversi: Link a Google Sheet. Si prega di notare che il file non è modificabile, è necessario scaricarlo o fare una copia sul disco per poterlo modificare.

Passaggio 2: codice

Codice
Codice

Il codice per il display e per l'ADC è abbastanza grande e non ci sarebbe abbastanza memoria sull'arduino se usassi caratteri grandi sullo schermo.

Per risolvere questo problema, ho convertito il testo in codice creando un'immagine contenente il testo e quindi utilizzando questo strumento online per convertire l'immagine in codice leggibile da arduino:

Ho ancora usato alcuni font e caratteri, ma uso solo un font contenente numeri per visualizzare la tensione della batteria e la percentuale di carica per risparmiare memoria.

Questo codice visualizza la tensione della batteria e visualizza la percentuale di carica, supponendo che a 90v la batteria sia carica e che a 0v la batteria sia completamente scarica. Questo può essere modificato in base alle proprie esigenze.

// la classe base GxEPD2_GFX può essere utilizzata per passare riferimenti o puntatori all'istanza di visualizzazione come parametro, utilizza ~1.2k di codice in più

// abilita o disabilita la classe base GxEPD2_GFX #define ENABLE_GxEPD2_GFX 0 #include #include #include #include #include #include Adafruit_ADS1115 ads(0x48); //Indirizzo dell'ADC #se definito(_AVR) #define MAX_DISPLAY_BUFFER_SIZE 800 // #define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT_BUFFER_DISPLAY EPD::WIDTH / 8)) GxEPD2_BW display(GxEPD2_290(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); #endif U8G2_FOR_ADAFRUIT_GFX u8g2Fonts; void setup() { Serial.begin(115200); Serial.println(); Serial.println("configurazione"); annunci.begin(); display.init(); u8g2Fonts.begin(display); // collega le procedure u8g2 a Adafruit GFX showbitmaps(); ritardo (500); Serial.println("installazione completata"); } ciclo vuoto() { valori(); ritardo(1000); } // 'charge-icon-c', 128x40px const unsigned char Bat PROGMEM = { 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0x, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0f, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0x8, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x00, 0x, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x01, 0xff, 0x80, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf, 0x07, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x00, 0x7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0f, 0x87, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0x ff, 0xf0, 0xf8, 0x01, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x,0, 0x7 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff 0xf8, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x01, 0xff, 0xf0, 0x 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x01, 0xff, 0x80, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0x,0f 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x,07 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00 0x00, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x87, 0xff, 0xff, 0xff 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0x,ff 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf 0xff, 0xff }; const unsigned char battext PROGMEM = { // 'logisoso_epaper_volts_simple4, 128x145px 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0xff, 0xff, 0x 0xff, 0xf8, 0xff, 0x1f, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0x1f, 0x1f, 0xff, 0xff 0x87, 0xf1, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xfe, 0x1f, 0x1f, 0xff, 0xf8, 0xff, 0xff, 0x8f, 0xf1, 0xf8, 0xff, 0xff, 0xff, 0 0x7e, 0x1f, 0x1f, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xf1, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x38, 0x00, 0x1f, 0xff, 0xf8, 0xff, 0xf 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x3f, 0xff, 0xf8, 0xff, 0xff, 0xc3, 0xc0, 0x61, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xe0, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x, 0xff, 0xfc, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x41, 0x07, 0xff, 0xff, 0x, 0xe0, 0x38, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x18, 0x7f, 0xff, 0xff, 0xff, 0x8, 0xf1, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x18, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0x0e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0x0e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x07, 0x ff, 0xff, 0xf8, 0xff, 0xff, 0xc7, 0x0e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff 0xf8, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xff, 0x87, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x8f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xf8, 0xff, 0xff, 0xcf, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0x00, 0x00, 0x0f, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x0f, 0x, 0x, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x0f, 0xff, 0xfc, 0xff, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xff, 0xff 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff,, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x07,, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x31, 0x87, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xff, 0xff, 0xf8, 0x71, 0xc3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0x ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x71, 0xc3, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x30, 0x07, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0,ff 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x03, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0xf8, 0x00, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0x 0xff, 0xff, 0xe0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xfc, 0x00, 0x03, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xc3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,0xc3, 0xff, 0xff, 0xfd, 0xff, 0xff, 0x80, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x 0xff, 0xff, 0xff, 0x1f, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0xf0, 0x03, 0xff, 08 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0x00, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf, 0xe0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc3, 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xff, 0, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87,1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xfd, 0xff, 0xff, 0x87, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xff, 0xff, 0xff, 0xff, 0xc7, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xff, 0xff, 0xf0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x ff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff 0xf0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xf8, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x07, 0xfc, 0x9f, 0xff, 0xff, 0xff 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0x1f, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0x, 0xc0, 0x3e, 0x3f, 0xff, 0xf8, 0xff, 0xff, 0x8f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x78, 0x07, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0x00, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x, 0,8, 0x3f, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x3f, 0xf8, 0x0f, 0xff, 0xf8, 0xff, 0xff, 0, 01, f1, 0xff 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0x0f, 0xff, 0xf8, 0xff, 0xff, 0xe1, 0xc0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xdf, 0xff, 0xf9, 0xff, 0xff, 0xc1, 0x80, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xc7, 0x8e, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0x0e, 0x1f, 0xff, 0x, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0x0e, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,, 0xc7, 0x1e, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x18, 0x3f, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xe0, 0x38, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x ff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; //questa funzione disegna le immagini void showbitmaps() { uint16_t bg = GxEPD_WHITE; uint16_t fg = GxEPD_BLACK; display.firstPage(); do { display.fillScreen(bg); display.drawImage(battext, 0, 60, 128, 145, falso, 0, vero); //testo (y dal basso, x da sinistra, altezza y, lunghezza x, reverse_color(vero/falso), ruotare (0, 1), trasparenza?(vero/falso)) display.drawImage(Bat, 0, 5, 128, 40, falso, 0, vero); //icona batteria } while (display.nextPage()); } //questa funzione calcola e stampa i valori sul display void values() { float battV; // Perc. float di tensione della batteria; // Batteria % int calib = 7; // Valore di calibrazione di ADS1115 per ridurre l'errore float voltage =0; // utilizzato per memorizzare il valore di tensione float Radjust = 0.01437283477; // Fattore divisore di tensione (R2 / R1+R2) R1 ~690k e R2 ~10k int16_t adc0; // Lettura ADC a 16 bit dell'ingresso A0 adc0 = ads.readADC_SingleEnded(0); tensione = ((adc0 + calib) * 0,1875)/1000; battV = tensione/regolazione; // Calcola % perc batteria = (battV/ 90) * 100; //supponiamo che la tensione massima della batteria sia 90v //mantenere la batteria % 2 cifre max per evitare problemi di visualizzazione if (perc >= 100){ perc = 99; } display.setRotation(1); // 0 Nessuna rotazione, 1 rotazione di 90 gradi uint16_t bg = GxEPD_WHITE; uint16_t fg = GxEPD_BLACK; u8g2Fonts.setFontMode(1); // usa la modalità trasparente u8g2 (questa è l'impostazione predefinita) u8g2Fonts.setFontDirection(0); // da sinistra a destra (questa è l'impostazione predefinita) u8g2Fonts.setForegroundColor(fg); // applica il colore Adafruit GFX u8g2Fonts.setBackgroundColor(bg); // applica Adafruit GFX color u8g2Fonts.setFont(u8g2_font_logisoso32_tn); // o u8g2_font_logisoso32_tr o u8g2_font_logisoso32_tn display.setPartialWindow(203, 0, 100, 128); //(x da sinistra, y dall'alto, lunghezza x, altezza y) imposta una finestra per l'aggiornamento parziale dei valori display.firstPage(); do { display.fillScreen(bg); //Stampa tensione batteria u8g2Fonts.setCursor(205, 52); u8g2Fonts.print(battV, 1); //Stampa batteria % u8g2Fonts.setCursor(205, 110); u8g2Fonts.print(perc, 0); } while (display.nextPage()); }

Passaggio 3: testiamolo:)

Proviamolo:)
Proviamolo:)

Sono abbastanza soddisfatto dei risultati.

Sono stato in grado di testare un numero di tensioni da circa 9v a circa 85v con una deviazione minima (meno di 0,2 volt) dalla tensione effettiva.

Una volta confezionato in una bella custodia, questo dovrebbe essere un bel voltmetro che può essere letto in ambienti molto luminosi:).

Consigliato: