Mục lục:

Vôn kế chính xác hiển thị điện tử Waveshare (0-90v DC) Với Arduino Nano: 3 bước
Vôn kế chính xác hiển thị điện tử Waveshare (0-90v DC) Với Arduino Nano: 3 bước

Video: Vôn kế chính xác hiển thị điện tử Waveshare (0-90v DC) Với Arduino Nano: 3 bước

Video: Vôn kế chính xác hiển thị điện tử Waveshare (0-90v DC) Với Arduino Nano: 3 bước
Video: MLX90614 non contact infrared temperature sensor with Arduino, MLX90614 Emissivity Calibration 2024, Tháng mười một
Anonim

Trong phần Có thể hướng dẫn này, tôi sử dụng màn hình Waveshare E-Paper 2,9’’ với Arduino Nano, bộ chia điện áp và ADS1115 để hiển thị điện áp chính xác lên đến 90 volt DC trên Màn hình E-Paper.

Hướng dẫn này kết hợp hai dự án trước đó:

- Đồng hồ đo điện áp Arduino (0-100V DC) - Phiên bản 2 -

- Làm mới một phần màn hình điện tử với Arduino -

Quân nhu

Nguồn cung cấp được sử dụng:

1 x Arduino Nano -

1 x màn hình Waveshare -

Bảng mạch và dây -

Ngân hàng điện USB -

1 x ADS 1115 - ADC 16 bit -

1 x 1 / 4W (tôi khuyên bạn nên sử dụng điện trở 1W) Điện trở 1% - 690k ohm -

1 x 1 / 4W (tôi khuyên bạn nên sử dụng điện trở 1W) Điện trở 1% - 10k ohm -

Astro AI DM6000AR -

Pin 9V -

CanadianWinters là người tham gia Chương trình liên kết Amazon Services LLC, một chương trình quảng cáo liên kết được thiết kế để cung cấp phương tiện cho các trang web kiếm phí bằng cách liên kết đến Amazon.com và các trang web liên kết. Bằng cách sử dụng các liên kết này, với tư cách là Cộng tác viên của Amazon, tôi kiếm được từ các giao dịch mua đủ điều kiện, ngay cả khi bạn mua thứ khác - và bạn sẽ không mất bất cứ chi phí nào.

Bước 1: Hãy kết nối các thành phần

Hãy kết nối các thành phần
Hãy kết nối các thành phần

Tôi đã kết nối các thành phần như sau:

Màn hình Waveshare:

Hiển thị Arduino

BẬN D7

RST D8

DC D9

CS D10

DIN D11

CLK D13

GND GND

VCC 3.3V

ADS1115:

ADS1115 Arduino

VCC 5V

GND GND

ĐỊA CHỈ GND

SCL A5

SDA A4

Bộ chia điện áp AIN0

Đối với bộ chia điện áp, lần này tôi sử dụng điện trở 680Kohm và 10Kohm. Tôi luôn đo các giá trị điện trở để có độ chính xác tốt hơn.

Các tính toán cho bộ chia điện áp có sẵn tại bảng tính này để tự động tính toán trong trường hợp bạn muốn sử dụng các giá trị điện trở khác nhau: Liên kết tới Google Trang tính. Xin lưu ý rằng tệp không thể chỉnh sửa được, bạn cần tải xuống hoặc tạo một bản sao trên ổ đĩa của mình để có thể sửa đổi tệp.

Bước 2: Mã

Mã số
Mã số

Mã cho màn hình và cho ADC khá lớn và sẽ không có đủ bộ nhớ trên arduino nếu tôi sử dụng các ký tự lớn trên màn hình.

Để giải quyết vấn đề này, tôi đã chuyển đổi văn bản thành mã bằng cách tạo một hình ảnh có chứa văn bản và sau đó sử dụng công cụ trực tuyến này để chuyển đổi hình ảnh thành mã có thể đọc được bởi arduino:

Tôi vẫn sử dụng một số phông chữ và ký tự, nhưng tôi chỉ sử dụng phông chữ có chứa số để hiển thị điện áp pin và phần trăm sạc nhằm tiết kiệm bộ nhớ.

Mã này hiển thị điện áp của pin và hiển thị phần trăm sạc, giả sử rằng ở 90v pin được sạc và ở 0v pin hoàn toàn bằng phẳng. Điều này có thể được sửa đổi để phù hợp với nhu cầu của bạn.

// lớp cơ sở GxEPD2_GFX có thể được sử dụng để chuyển các tham chiếu hoặc con trỏ đến cá thể hiển thị dưới dạng tham số, sử dụng thêm ~ 1,2k mã

// bật hoặc tắt lớp cơ sở GxEPD2_GFX #define ENABLE_GxEPD2_GFX 0 #include #include #include #include #include #include Adafruit_ADS1115 ads (0x48); // Địa chỉ của ADC #if được xác định (_ AVR) #define MAX_DISPLAY_BUFFER_SIZE 800 // #define MAX_HEIGHT (EPD) (EPD:: HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD:: WIDTH / 8)? EPD:: HEIGHT: MAX_DISPLAY_BUFFER_SIZE: MAX_DISPLAY_BUFFER_SIZE EPD:: WIDTH / 8)) Hiển thị GxEPD2_BW (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 ("thiết lập"); ads.begin (); display.init (); u8g2Fonts.begin (hiển thị); // kết nối các thủ tục u8g2 với Adafruit GFX showbitmaps (); chậm trễ (500); Serial.println ("thiết lập xong"); } void loop () {giá trị (); chậm trễ (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, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 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, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, 0xfxf, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x3f, 0xf80, 0, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x01, 0xff, 0x80, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf00, 0xffxf8xf00, 0x07, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x3f, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0xffx07, 0xffx07, 0xffx07, 0xffx07, 0x00, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x0f, 0x87, 0xc7ff, 0x87, 0xc7ff, 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, 0xe000, 0x00 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0f0ff, 0xff, 0xff, 0xff, 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, 0x00, 0xf0, 0x00 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x01, 0xff, 0x80, 0x00, 0x00, 0x0f, 0x87, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xf0 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x0 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf8, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x07, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 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, 0xff, 0xff, 0, 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, 0xff 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 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, 0x00x00, 0xf0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xffx1 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, 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, 0xf8, 0x00, 0x00, 0x1f, 0xff, 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, 0xff, 0xff, 0xff 0xff, 0xf8, 0xff, 0x1f, 0x1f, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0x1f, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0x87, 0xf1, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xfe, 0x1f, 0x1f, 0xff, 0xf8, 0xff, 0xff, 0x8f, 0xf1, 0xf8, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xfx 0x7e, 0x1f, 0x1f, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xf1, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x38, 0x00, 0x1f, 0xff, 0xf7, 0xff, 0xexc 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, 0xff 0x7f, 0xff, 0xf8, 0xff, 0xff, 0xe0, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf0, 0x04 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, 0xfxff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x03, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x41, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x38, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf1, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x18, 0x7f, 0xff, 0xff, 0f8xff, 0xff, 0xff, 0xff, 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, 0xfff8, 0xff, 0xff, 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, 0xff 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x1f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff 0xf8, 0xff, 0xff, 0xc0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc3, 0xff, 0xff, 0, 0xff, 0xff, 0, 0xff 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 0xff, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x0f, 0xff, 0xff, 0, 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, 0xff, 0xf8, 0xff, 0xf8 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xfe, 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, 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, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0x00, 0x00, 0x0f, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x0f, 0xf8 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x0f, 0xff, 0xfc, 0xff, 0xff, 0xe0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xf8, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xe3, 0xff, 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, 0xff, 0xcf, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 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, 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, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0x1f, 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, 0x03 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 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, 0, 0xff, 0xff 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, 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, 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, 0x1f00, 0xc0, 0x1f00 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, 0xff, 0xff, 0xff, 0xf8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0ff, 0xffx, 0xc0ff 0 0xff, 0xff, 0xff, 0x1f, 0xff, 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0xf0, 0x03, 0xff, 0xf8xff, 0xf8xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x3f, 0x00, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf8 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, 0xff, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x03, 0xff, 0xff, 0xf8, 0xff, 0xffe, 0x87, 0xff, 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, 0xff, 0xc7, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x3f, 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, 0xff, 0xf0, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x07, 0xff, 0xff, 0xff, 0xff, 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, 0xff 0xf0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 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, 0xff, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xff, 0xff, 0xff, 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, 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, 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, 0xff, 0xff, 0xff 0xff, 0xf8, 0x3f, 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x07, 0xfc, 0x9f, 0xff, 0x9f, 0xff, 0x9f, 0xff, 0x9f, 0xff 0xc0, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xfc, 0x1f, 0xff, 0xf8, 0xff, 0xff, 0x87, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0xc0, 0x3e, 0x3f, 0xff, 0xf8, 0xff, 0xff, 0x8f, 0xff, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x78, 0x07, 0xff, 0xff, 0xff8, 0xff, 0xff, 0xff8, 0xff, 0xff 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x3f, 0x00, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffx3, 0xf8, 0xffx3, 0xf8 0x3f, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf9, 0x3f, 0xf8, 0x0f, 0xff, 0xff8, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xf1, 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, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc7, 0x8e, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0x0e, 0x1f, 0xffxff, 0xffxff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x87, 0x0e, 0x1f, 0xff, 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, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xe0, 0x38, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xf8, 0xfff0xff, 0xf8, 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, 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, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 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, 0xff, 0xf9, 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, 0xff, 0xff, 0xff, 0xff 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; // hàm này vẽ ảnh void showbitmaps () {uint16_t bg = GxEPD_WHITE; uint16_t fg = GxEPD_BLACK; display.firstPage (); làm {display.fillScreen (bg); display.drawImage (battext, 0, 60, 128, 145, false, 0, true); // text (y từ dưới lên, x từ trái, chiều cao y, chiều dài x, reverse_color (true / false), xoay (0, 1), trong suốt? (true / false)) display.drawImage (Bat, 0, 5, 128, 40, sai, 0, đúng); // biểu tượng pin} while (display.nextPage ()); } // hàm này tính toán và in ra các giá trị trên display void values () {float battV; // Pin Điện áp float perc; // Pin% int calib = 7; // Giá trị hiệu chỉnh của ADS1115 để giảm lỗi float điện áp = 0; // dùng để lưu giá trị điện áp float Radjust = 0.01437283477; // Hệ số phân áp (R2 / R1 + R2) R1 ~ 690k và R2 ~ 10k int16_t adc0; // 16 bit ADC đọc đầu vào A0 adc0 = ads.readADC_SingleEnded (0); điện áp = ((adc0 + hiệu chuẩn) * 0,1875) / 1000; battV = điện áp / Điều chỉnh; // Tính% pin perc = (battV / 90) * 100; // chúng tôi giả định rằng điện áp tối đa của pin là 90v // giữ% pin tối đa 2 chữ số để tránh các vấn đề hiển thị if (perc> = 100) {perc = 99; } display.setRotation (1); // 0 Không xoay, 1 xoay 90 độ uint16_t bg = GxEPD_WHITE; uint16_t fg = GxEPD_BLACK; u8g2Fonts.setFontMode (1); // sử dụng chế độ trong suốt u8g2 (đây là mặc định) u8g2Fonts.setFontDirection (0); // từ trái sang phải (đây là mặc định) u8g2Fonts.setForegroundColor (fg); // áp dụng màu Adafruit GFX u8g2Fonts.setBackgroundColor (bg); // áp dụng màu Adafruit GFX u8g2Fonts.setFont (u8g2_font_logisoso32_tn); // hoặc u8g2_font_logisoso32_tr hoặc u8g2_font_logisoso32_tn display.setPartialWindow (203, 0, 100, 128); // (x từ trái, y từ trên cùng, chiều dài x, chiều cao y) điều này đặt một cửa sổ cho các giá trị cập nhật từng phần display.firstPage (); làm {display.fillScreen (bg); // In điện áp pin u8g2Fonts.setCursor (205, 52); u8g2Fonts.print (battV, 1); // In pin% u8g2Fonts.setCursor (205, 110); u8g2Fonts.print (perc, 0); } while (display.nextPage ()); }

Bước 3: Hãy kiểm tra nó ra:)

Hãy kiểm tra nó ra:)
Hãy kiểm tra nó ra:)

Tôi khá hài lòng với kết quả.

Tôi đã có thể kiểm tra một số điện áp từ khoảng 9v đến khoảng 85v với độ lệch tối thiểu (ít hơn 0,2V) so với điện áp thực tế.

Sau khi được đóng gói thành một vỏ bọc đẹp mắt, nó sẽ tạo thành một đồng hồ đo vôn nhỏ xinh xắn có thể đọc được trong môi trường rất sáng:).

Đề xuất: