РН-датчик для Arduino, BNC AVR STM32 51
ЦЕНА:US $23.49
https://ali.pub/5ghtw0
Если вам нужно измерить качество воды и другие её параметры и вам нужен недорогой рН-метр, который можно использовать с Arduino, то это он. Представляем вам аналоговый pH-метр, специально разработанный для контроллеров Arduino. Он имеет простое, удобное и практичное подключение, а тажке ряд встроенных функций.
На приборе есть светодиод, который работает как индикатор питания, разъем BNC и интерфейс датчика PH2.0. Чтобы использовать устройство, просто подключите датчик pH к разъему BNC, а интерфейс PH2.0 к аналоговому входному порту любого контроллера Arduino. Если он был запрограммирован заранее, вы сразу же сможете получить значение pH.
Поставляется в компактной картонной коробке с отсеками из пены для лучшей транспортировки и хранения.
Чтобы обеспечить точность pH-зонда, вам необходимо регулярно калибровать его используя стандартный способ. Вообще, период между калибровками составляет около полугода, но если вы часто имеете дело с грязными водными растворами, то вам нужно увеличить частоту калибровки.
КОд :
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
float calibration_value = 21.34;
int phval = 0;
unsigned long int avgval;
int buffer_arr[10],temp;
void setup()
{
Serial.begin(9600);
lcd.init();
lcd.begin(16, 2);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" Welcome to ");
lcd.setCursor(0, 1);
lcd.print(" Digitrode ");
delay(2000);
lcd.clear();
}
void loop() {
for(int i=0;i<10;i++)
{
buffer_arr[i]=analogRead(A0);
delay(30);
}
for(int i=0;i<9;i++)
{
for(int j=i+1;j<10;j++)
{
if(buffer_arr[i]>buffer_arr[j])
{
temp=buffer_arr[i];
buffer_arr[i]=buffer_arr[j];
buffer_arr[j]=temp;
}
}
}
avgval=0;
for(int i=2;i<8;i++)
avgval+=buffer_arr[i];
float volt=(float)avgval*5.0/1024/6;
float ph_act = -5.70 * volt + calibration_value;
lcd.setCursor(0, 0);
lcd.print("pH Val:");
lcd.setCursor(8, 0);
lcd.print(ph_act);
delay(1000);
}
ЦЕНА:US $23.49
https://ali.pub/5ghtw0
Если вам нужно измерить качество воды и другие её параметры и вам нужен недорогой рН-метр, который можно использовать с Arduino, то это он. Представляем вам аналоговый pH-метр, специально разработанный для контроллеров Arduino. Он имеет простое, удобное и практичное подключение, а тажке ряд встроенных функций.
На приборе есть светодиод, который работает как индикатор питания, разъем BNC и интерфейс датчика PH2.0. Чтобы использовать устройство, просто подключите датчик pH к разъему BNC, а интерфейс PH2.0 к аналоговому входному порту любого контроллера Arduino. Если он был запрограммирован заранее, вы сразу же сможете получить значение pH.
Поставляется в компактной картонной коробке с отсеками из пены для лучшей транспортировки и хранения.
Чтобы обеспечить точность pH-зонда, вам необходимо регулярно калибровать его используя стандартный способ. Вообще, период между калибровками составляет около полугода, но если вы часто имеете дело с грязными водными растворами, то вам нужно увеличить частоту калибровки.
КОд :
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
float calibration_value = 21.34;
int phval = 0;
unsigned long int avgval;
int buffer_arr[10],temp;
void setup()
{
Serial.begin(9600);
lcd.init();
lcd.begin(16, 2);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" Welcome to ");
lcd.setCursor(0, 1);
lcd.print(" Digitrode ");
delay(2000);
lcd.clear();
}
void loop() {
for(int i=0;i<10;i++)
{
buffer_arr[i]=analogRead(A0);
delay(30);
}
for(int i=0;i<9;i++)
{
for(int j=i+1;j<10;j++)
{
if(buffer_arr[i]>buffer_arr[j])
{
temp=buffer_arr[i];
buffer_arr[i]=buffer_arr[j];
buffer_arr[j]=temp;
}
}
}
avgval=0;
for(int i=2;i<8;i++)
avgval+=buffer_arr[i];
float volt=(float)avgval*5.0/1024/6;
float ph_act = -5.70 * volt + calibration_value;
lcd.setCursor(0, 0);
lcd.print("pH Val:");
lcd.setCursor(8, 0);
lcd.print(ph_act);
delay(1000);
}
aliexpress.com
US $23.74 5% OFF|PH Sensor For Arduino Liquid PH0 14 Value Detection Sensor Module + PH Electrode Probe BNC AVR STM32 51|Sensors|…
Smarter Shopping, Better Living! Aliexpress.com
Датчик температуры 18B20 в корпусе из нержавеющей стали. Длина провода на выбор 1-3 метра .
US $1.02 - 1.52US $1.02 - 1.52
https://ali.pub/5k1vfr
Arduino и цифровой датчик температуры DS18B20
DS18B20 - это цифровой датчик температуры. Датчик очень прост в использовании.
Во-первых, он цифровой, а во вторых - у него всего лишь один контакт, с которого мы получаем полезный сигнал. То есть, вы можете подключить к одному Arduino одновременно огромное количество этих сенсоров. Пинов будет более чем достаточно. Мало того, вы даже можете подключить несколько сенсоров к одному пину на Arduino! Но обо всем по порядку.
Подключение DS18B20 к Arduino
Датчик подключается элементарно.
Контакт GND с DS18B20 подключается к GND на Arduino.
Контакт Vdd с DS18B20 подключается к +5V на Arduino.
Контакт Data с DS18B20 подключается к любому цифровому пину на Arduino. В данном примере используется пин 2.
Единственное, что необходимо добавить из внешней дополнительной обвязки - это подтягивающий резистор на 4.7 КОм.
Схема подключения DS18B20 к Arduino показана ниже (в скетче, который будет приведен ниже, проверьте строки 10 и 65. В них указаны пины, к которым вы подключали контакт сигнала с датчика и режим питания!):
Убедитесь, что вы указали корректные пины!
В строке 10, где указано “OneWire ds(2);” устанавливается пин, к которому подключен контакт data с сенсора.
В этом примере использован пин 2, но значения пина по умолчанию в примере OneWire стоит на 10. Можно использовать и его.
#include <OneWire.h>
// пример использования библиотеки OneWire DS18S20, DS18B20, DS1822
OneWire ds(2); // на пине 10 (нужен резистор 4.7 КОм)
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
byte i;
byte present = 0;
byte type_s;
byte data data[0;
if (type_s) {
raw = raw « 3; // разрешение 9 бит по умолчанию
if (data[7] == 0x10) {
raw = (raw & 0xFFF0) + 12 - data[6];
}
} else {
byte cfg = (data[4] & 0x60);
// при маленьких значениях, малые биты не определены, давайте их обнулим
if (cfg == 0x00) raw = raw & ~7; // разрешение 9 бит, 93.75 мс
else if (cfg == 0x20) raw = raw & ~3; // разрешение 10 бит, 187.5 мс
else if (cfg == 0x40) raw = raw & ~1; // разрешение 11 бит, 375 мс
//// разрешение по умолчанию равно 12 бит, время преобразования - 750 мс
}
celsius = (float)raw / 16.0;
fahrenheit = celsius * 1.8 + 32.0;
Serial.print(" Temperature = ");
Serial.print(celsius);
Serial.print(" Celsius, ");
Serial.print(fahrenheit);
Serial.println(" Fahrenheit");
}
US $1.02 - 1.52US $1.02 - 1.52
https://ali.pub/5k1vfr
Arduino и цифровой датчик температуры DS18B20
DS18B20 - это цифровой датчик температуры. Датчик очень прост в использовании.
Во-первых, он цифровой, а во вторых - у него всего лишь один контакт, с которого мы получаем полезный сигнал. То есть, вы можете подключить к одному Arduino одновременно огромное количество этих сенсоров. Пинов будет более чем достаточно. Мало того, вы даже можете подключить несколько сенсоров к одному пину на Arduino! Но обо всем по порядку.
Подключение DS18B20 к Arduino
Датчик подключается элементарно.
Контакт GND с DS18B20 подключается к GND на Arduino.
Контакт Vdd с DS18B20 подключается к +5V на Arduino.
Контакт Data с DS18B20 подключается к любому цифровому пину на Arduino. В данном примере используется пин 2.
Единственное, что необходимо добавить из внешней дополнительной обвязки - это подтягивающий резистор на 4.7 КОм.
Схема подключения DS18B20 к Arduino показана ниже (в скетче, который будет приведен ниже, проверьте строки 10 и 65. В них указаны пины, к которым вы подключали контакт сигнала с датчика и режим питания!):
Убедитесь, что вы указали корректные пины!
В строке 10, где указано “OneWire ds(2);” устанавливается пин, к которому подключен контакт data с сенсора.
В этом примере использован пин 2, но значения пина по умолчанию в примере OneWire стоит на 10. Можно использовать и его.
#include <OneWire.h>
// пример использования библиотеки OneWire DS18S20, DS18B20, DS1822
OneWire ds(2); // на пине 10 (нужен резистор 4.7 КОм)
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
byte i;
byte present = 0;
byte type_s;
byte data data[0;
if (type_s) {
raw = raw « 3; // разрешение 9 бит по умолчанию
if (data[7] == 0x10) {
raw = (raw & 0xFFF0) + 12 - data[6];
}
} else {
byte cfg = (data[4] & 0x60);
// при маленьких значениях, малые биты не определены, давайте их обнулим
if (cfg == 0x00) raw = raw & ~7; // разрешение 9 бит, 93.75 мс
else if (cfg == 0x20) raw = raw & ~3; // разрешение 10 бит, 187.5 мс
else if (cfg == 0x40) raw = raw & ~1; // разрешение 11 бит, 375 мс
//// разрешение по умолчанию равно 12 бит, время преобразования - 750 мс
}
celsius = (float)raw / 16.0;
fahrenheit = celsius * 1.8 + 32.0;
Serial.print(" Temperature = ");
Serial.print(celsius);
Serial.print(" Celsius, ");
Serial.print(fahrenheit);
Serial.println(" Fahrenheit");
}
aliexpress.com
1.02US $ 26% OFF|1PCS DS1820 Stainless steel package Waterproof DS18b20 temperature probe temperature sensor 18B20 For Arduino|Sensors|…
Smarter Shopping, Better Living! Aliexpress.com
Тензометрические датчики (весовые) 1кг 5кг 10кг 20кг + модуль АЦП HX711 AD . Можно использовать вместе с ардуино , собрать например весы или датчик тяги.
US $0.58 - 1.79
https://ali.pub/4k2k8a
Весы на ардуино при помощи модуля HX711 и тензодатчика.
Состоят весы из двух частей, тензодатчика и модуля на микросхеме HX711. HX711 это 24 битный аналого-цифровой преобразователь специализированный для весов, к которому подключается тензодатчик.
Модуль можно подключать на два любых выхода arduino, в данном случаи подключено на два аналоговых входа, но работают они как цифровые.
Софт:https://github.com/bogde/HX711
Код из видео для калибровки:
Код для калибровки
/*
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Arduino pin 6 -> HX711 CLK
Arduino pin 5 -> HX711 DOUT
Arduino pin 5V -> HX711 VCC
Arduino pin GND -> HX711 GND
*/
#include "HX711.h"
HX711 scale(A1, A0); // DT, CLK
float calibration_factor = -3.7; // this calibration factor is adjusted according to my load cell
float units;
float ounces;
void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
units = scale.get_units(), 10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274;
Serial.print(ounces);
Serial.print(" grams");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}
#include "HX711.h"
HX711 scale(A1, A0);
float calibration_factor = -3.7; // калибровка!
float units;
float ounces;
void setup() {
Serial.begin(9600);
scale.set_scale();
scale.tare(); //Сбрасываем на 0
scale.set_scale(calibration_factor); //Применяем калибровку
}
void loop() {
Serial.print("Reading: ");
for(int i = 0;i < 10; i ++) units =+ scale.get_units(), 10; // усредняем показания считав 10 раз
units / 10; // делим на 10
ounces = units * 0.035274; // переводим унции в граммы
Serial.print(ounces); // отправляем в монитор порта
Serial.print(" grams");
Serial.println();
}
US $0.58 - 1.79
https://ali.pub/4k2k8a
Весы на ардуино при помощи модуля HX711 и тензодатчика.
Состоят весы из двух частей, тензодатчика и модуля на микросхеме HX711. HX711 это 24 битный аналого-цифровой преобразователь специализированный для весов, к которому подключается тензодатчик.
Модуль можно подключать на два любых выхода arduino, в данном случаи подключено на два аналоговых входа, но работают они как цифровые.
Софт:https://github.com/bogde/HX711
Код из видео для калибровки:
Код для калибровки
/*
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Arduino pin 6 -> HX711 CLK
Arduino pin 5 -> HX711 DOUT
Arduino pin 5V -> HX711 VCC
Arduino pin GND -> HX711 GND
*/
#include "HX711.h"
HX711 scale(A1, A0); // DT, CLK
float calibration_factor = -3.7; // this calibration factor is adjusted according to my load cell
float units;
float ounces;
void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
units = scale.get_units(), 10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274;
Serial.print(ounces);
Serial.print(" grams");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}
#include "HX711.h"
HX711 scale(A1, A0);
float calibration_factor = -3.7; // калибровка!
float units;
float ounces;
void setup() {
Serial.begin(9600);
scale.set_scale();
scale.tare(); //Сбрасываем на 0
scale.set_scale(calibration_factor); //Применяем калибровку
}
void loop() {
Serial.print("Reading: ");
for(int i = 0;i < 10; i ++) units =+ scale.get_units(), 10; // усредняем показания считав 10 раз
units / 10; // делим на 10
ounces = units * 0.035274; // переводим унции в граммы
Serial.print(ounces); // отправляем в монитор порта
Serial.print(" grams");
Serial.println();
}
aliexpress.com
0.58US $ 2% OFF|Load Cell 1KG 5KG 10KG 20KG HX711 AD Module Weight Sensor Electronic Scale Aluminum Alloy Weighing Pressure Sensor|Sensors|…
Smarter Shopping, Better Living! Aliexpress.com
Тензометрические датчики на 1-10 кг , а так же плата преобразователь АЦП HX711 AD для сборки весов.
US $4.18
https://ali.pub/5hyin9
Весы на ардуино :
#include "HX711.h"
HX711 scale;
void setup() {
Serial.begin(38400);
Serial.println("HX711 Demo");
Serial.println("Initializing the scale");
// parameter "gain" is ommited; the default value 128 is used by the library
// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0
scale.begin(3, 2);
Serial.println("Before setting up the scale:");
Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC
Serial.print("read average: \t\t");
Serial.println(scale.read_average(20)); // print the average of 20 readings from the ADC
Serial.print("get value: \t\t");
Serial.println(scale.get_value(5)); // print the average of 5 readings from the ADC minus the tare weight (not set yet)
Serial.print("get units: \t\t");
Serial.println(scale.get_units(5), 1); // print the average of 5 readings from the ADC minus tare weight (not set) divided
// by the SCALE parameter (not set yet)
scale.set_scale(994.68); // this value is obtained by calibrating the scale with known weights; see the README for details
scale.tare(); // reset the scale to 0
Serial.println("After setting up the scale:");
Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC
Serial.print("read average: \t\t");
Serial.println(scale.read_average(20)); // print the average of 20 readings from the ADC
Serial.print("get value: \t\t");
Serial.println(scale.get_value(5)); // print the average of 5 readings from the ADC minus the tare weight, set with tare()
Serial.print("get units: \t\t");
Serial.println(scale.get_units(5), 1); // print the average of 5 readings from the ADC minus tare weight, divided
// by the SCALE parameter set with set_scale
Serial.println("Readings:");
}
void loop() {
Serial.print("one reading:\t");
Serial.print(scale.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale.get_units(10), 1);
scale.power_down(); // put the ADC in sleep mode
delay(5000);
scale.power_up();
}
US $4.18
https://ali.pub/5hyin9
Весы на ардуино :
#include "HX711.h"
HX711 scale;
void setup() {
Serial.begin(38400);
Serial.println("HX711 Demo");
Serial.println("Initializing the scale");
// parameter "gain" is ommited; the default value 128 is used by the library
// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0
scale.begin(3, 2);
Serial.println("Before setting up the scale:");
Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC
Serial.print("read average: \t\t");
Serial.println(scale.read_average(20)); // print the average of 20 readings from the ADC
Serial.print("get value: \t\t");
Serial.println(scale.get_value(5)); // print the average of 5 readings from the ADC minus the tare weight (not set yet)
Serial.print("get units: \t\t");
Serial.println(scale.get_units(5), 1); // print the average of 5 readings from the ADC minus tare weight (not set) divided
// by the SCALE parameter (not set yet)
scale.set_scale(994.68); // this value is obtained by calibrating the scale with known weights; see the README for details
scale.tare(); // reset the scale to 0
Serial.println("After setting up the scale:");
Serial.print("read: \t\t");
Serial.println(scale.read()); // print a raw reading from the ADC
Serial.print("read average: \t\t");
Serial.println(scale.read_average(20)); // print the average of 20 readings from the ADC
Serial.print("get value: \t\t");
Serial.println(scale.get_value(5)); // print the average of 5 readings from the ADC minus the tare weight, set with tare()
Serial.print("get units: \t\t");
Serial.println(scale.get_units(5), 1); // print the average of 5 readings from the ADC minus tare weight, divided
// by the SCALE parameter set with set_scale
Serial.println("Readings:");
}
void loop() {
Serial.print("one reading:\t");
Serial.print(scale.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale.get_units(10), 1);
scale.power_down(); // put the ADC in sleep mode
delay(5000);
scale.power_up();
}
aliexpress.com
4.18US $ 10% OFF|Digital Load Cell Weight Sensor HX711 AD Converter Breakout Module 5KG 10KG Portable Electronic Kitchen Scale…
Smarter Shopping, Better Living! Aliexpress.com
Тензометрические датчики (весовые) 1кг 5кг 10кг 20кг + модуль АЦП HX711 AD . Можно использовать вместе с ардуино , собрать например весы или датчик тяги.
US $0.58 - 1.79
https://ali.pub/4k2k8a
Весы на ардуино при помощи модуля HX711 и тензодатчика.
Состоят весы из двух частей, тензодатчика и модуля на микросхеме HX711. HX711 это 24 битный аналого-цифровой преобразователь специализированный для весов, к которому подключается тензодатчик.
Модуль можно подключать на два любых выхода arduino, в данном случаи подключено на два аналоговых входа, но работают они как цифровые.
Софт:https://github.com/bogde/HX711
Код из видео для калибровки:
Код для калибровки
/*
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Arduino pin 6 -> HX711 CLK
Arduino pin 5 -> HX711 DOUT
Arduino pin 5V -> HX711 VCC
Arduino pin GND -> HX711 GND
*/
#include "HX711.h"
HX711 scale(A1, A0); // DT, CLK
float calibration_factor = -3.7; // this calibration factor is adjusted according to my load cell
float units;
float ounces;
void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
units = scale.get_units(), 10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274;
Serial.print(ounces);
Serial.print(" grams");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}
#include "HX711.h"
HX711 scale(A1, A0);
float calibration_factor = -3.7; // калибровка!
float units;
float ounces;
void setup() {
Serial.begin(9600);
scale.set_scale();
scale.tare(); //Сбрасываем на 0
scale.set_scale(calibration_factor); //Применяем калибровку
}
void loop() {
Serial.print("Reading: ");
for(int i = 0;i < 10; i ++) units =+ scale.get_units(), 10; // усредняем показания считав 10 раз
units / 10; // делим на 10
ounces = units * 0.035274; // переводим унции в граммы
Serial.print(ounces); // отправляем в монитор порта
Serial.print(" grams");
Serial.println();
}
US $0.58 - 1.79
https://ali.pub/4k2k8a
Весы на ардуино при помощи модуля HX711 и тензодатчика.
Состоят весы из двух частей, тензодатчика и модуля на микросхеме HX711. HX711 это 24 битный аналого-цифровой преобразователь специализированный для весов, к которому подключается тензодатчик.
Модуль можно подключать на два любых выхода arduino, в данном случаи подключено на два аналоговых входа, но работают они как цифровые.
Софт:https://github.com/bogde/HX711
Код из видео для калибровки:
Код для калибровки
/*
Setup your scale and start the sketch WITHOUT a weight on the scale
Once readings are displayed place the weight on the scale
Press +/- or a/z to adjust the calibration_factor until the output readings match the known weight
Arduino pin 6 -> HX711 CLK
Arduino pin 5 -> HX711 DOUT
Arduino pin 5V -> HX711 VCC
Arduino pin GND -> HX711 GND
*/
#include "HX711.h"
HX711 scale(A1, A0); // DT, CLK
float calibration_factor = -3.7; // this calibration factor is adjusted according to my load cell
float units;
float ounces;
void setup() {
Serial.begin(9600);
Serial.println("HX711 calibration sketch");
Serial.println("Remove all weight from scale");
Serial.println("After readings begin, place known weight on scale");
Serial.println("Press + or a to increase calibration factor");
Serial.println("Press - or z to decrease calibration factor");
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
Serial.println(zero_factor);
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print("Reading: ");
units = scale.get_units(), 10;
if (units < 0)
{
units = 0.00;
}
ounces = units * 0.035274;
Serial.print(ounces);
Serial.print(" grams");
Serial.print(" calibration_factor: ");
Serial.print(calibration_factor);
Serial.println();
if(Serial.available())
{
char temp = Serial.read();
if(temp == '+' || temp == 'a')
calibration_factor += 1;
else if(temp == '-' || temp == 'z')
calibration_factor -= 1;
}
}
#include "HX711.h"
HX711 scale(A1, A0);
float calibration_factor = -3.7; // калибровка!
float units;
float ounces;
void setup() {
Serial.begin(9600);
scale.set_scale();
scale.tare(); //Сбрасываем на 0
scale.set_scale(calibration_factor); //Применяем калибровку
}
void loop() {
Serial.print("Reading: ");
for(int i = 0;i < 10; i ++) units =+ scale.get_units(), 10; // усредняем показания считав 10 раз
units / 10; // делим на 10
ounces = units * 0.035274; // переводим унции в граммы
Serial.print(ounces); // отправляем в монитор порта
Serial.print(" grams");
Serial.println();
}
aliexpress.com
0.58US $ 2% OFF|Load Cell 1KG 5KG 10KG 20KG HX711 AD Module Weight Sensor Electronic Scale Aluminum Alloy Weighing Pressure Sensor|Sensors|…
Smarter Shopping, Better Living! Aliexpress.com
Датчик атмосферного давления, влажности и температуры BME280
US $2.08
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889
Модуль BME280 предназначен для измерения атмосферного давления, температуры и влажности. Это очередной датчик давления фирмы Bosch Sensortec для измерения атмосферного давления и температуры. По сравнению с первыми датчиками серии (BMP085 и BMP180) он имеет лучшие характеристики и меньшие размеры. Отличие от датчика BMP280 – наличие гигрометра, что позволяет измерять относительную влажность воздуха и создать на его основе маленькую метеостанцию.
#include <Wire.h>
#include <SPI.h>
// подключение библиотек
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <OLED_I2C.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme280; // BME280 на I2C
OLED oled(SDA, SCL, 8); //
extern uint8_t SmallFont[]; // шрифт
unsigned long millist;
String txt1="";
void setup() {
Serial.begin(9600);
bme280.begin();
oled.begin();
oled.setFont(SmallFont);
}
void loop() {
// прошло 5 секунд?
if(millis()-millist>=5000) {
oled.clrScr();
// температура
txt1="Temp=";
txt1= txt1+String(bme280.readTemperature());
txt1= txt1+" *C";
oled.print(txt1, CENTER, 10);
// влажность
txt1="Hum=";
txt1= txt1+String(bme280.readHumidity());
txt1= txt1+" %";
oled.print(txt1, CENTER, 25);
// давление
txt1="P=";
txt1= txt1+String(bme280.readPressure() / 100.0F);
txt1= txt1+" hPa";
oled.print(txt1, CENTER, 40);
oled.update();
// новый отсчет 5 секунд
millist=millis();
}
}
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889&from_content=wall_-107877557_118570&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353
US $2.08
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889
Модуль BME280 предназначен для измерения атмосферного давления, температуры и влажности. Это очередной датчик давления фирмы Bosch Sensortec для измерения атмосферного давления и температуры. По сравнению с первыми датчиками серии (BMP085 и BMP180) он имеет лучшие характеристики и меньшие размеры. Отличие от датчика BMP280 – наличие гигрометра, что позволяет измерять относительную влажность воздуха и создать на его основе маленькую метеостанцию.
#include <Wire.h>
#include <SPI.h>
// подключение библиотек
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <OLED_I2C.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme280; // BME280 на I2C
OLED oled(SDA, SCL, 8); //
extern uint8_t SmallFont[]; // шрифт
unsigned long millist;
String txt1="";
void setup() {
Serial.begin(9600);
bme280.begin();
oled.begin();
oled.setFont(SmallFont);
}
void loop() {
// прошло 5 секунд?
if(millis()-millist>=5000) {
oled.clrScr();
// температура
txt1="Temp=";
txt1= txt1+String(bme280.readTemperature());
txt1= txt1+" *C";
oled.print(txt1, CENTER, 10);
// влажность
txt1="Hum=";
txt1= txt1+String(bme280.readHumidity());
txt1= txt1+" %";
oled.print(txt1, CENTER, 25);
// давление
txt1="P=";
txt1= txt1+String(bme280.readPressure() / 100.0F);
txt1= txt1+" hPa";
oled.print(txt1, CENTER, 40);
oled.update();
// новый отсчет 5 секунд
millist=millis();
}
}
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889&from_content=wall_-107877557_118570&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353
Простые часы на ESp8266 +Oled display
Для сборки потребуется :
Плата NodeMcu v3 https://alii.pub/5wwx2u
0.96" I2C OLED Display https://ali.pub/54jn2p
Провода для спайки
Код
#include
#include
#include
#include
#include
#include
#define OLED_RESET LED_BUILTIN //4
Adafruit_SSD1306 display(OLED_RESET);
const char* ssid = "имя сети";
const char* password = "пароль от вай-фая";
int ledPin = 13;
int timezone = 7 * 3600;
int dst = 0;
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Clear the buffer.
display.clearDisplay();
display.display();
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin,LOW);
Serial.begin(115200);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Wifi connecting to ");
display.println( ssid );
WiFi.begin(ssid,password);
display.println("\nConnecting");
display.display();
while( WiFi.status() != WL_CONNECTED ){
delay(500);
display.print(".");
display.display();
}
// Clear the buffer.
display.clearDisplay();
display.display();
display.setCursor(0,0);
display.println("Wifi Connected!");
display.print("IP:");
display.println(WiFi.localIP() );
display.display();
configTime(timezone, dst, "pool.ntp.org","time.nist.gov");
display.println("\nWaiting for NTP...");
while(!time(nullptr)){
Serial.print("*");
delay(1000);
}
display.println("\nTime response....OK");
display.display();
delay(1000);
display.clearDisplay();
display.display();
}
void loop() {
time_t now = time(nullptr);
struct tm* p_tm = localtime(&now);
Serial.print(p_tm->tm_mday);
Serial.print("/");
Serial.print(p_tm->tm_mon + 1);
Serial.print("/");
Serial.print(p_tm->tm_year + 1900);
Serial.print(" ");
Serial.print(p_tm->tm_hour);
Serial.print(":");
Serial.print(p_tm->tm_min);
Serial.print(":");
Serial.println(p_tm->tm_sec);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(p_tm->tm_hour);
display.print(":");
if( p_tm->tm_min <10)
display.print("0");
display.print(p_tm->tm_min);
display.setTextSize(2);
display.setCursor(90,5);
display.print(".");
if( p_tm->tm_sec <10)
display.print("0");
display.print(p_tm->tm_sec);
display.setTextSize(1);
display.setCursor(0,40);
display.print(p_tm->tm_mday);
display.print("/");
display.print(p_tm->tm_mon + 1);
display.print("/");
display.print(p_tm->tm_year + 1900);
display.display();
delay(1000); // update every 1 sec
}
Для сборки потребуется :
Плата NodeMcu v3 https://alii.pub/5wwx2u
0.96" I2C OLED Display https://ali.pub/54jn2p
Провода для спайки
Код
#include
#include
#include
#include
#include
#include
#define OLED_RESET LED_BUILTIN //4
Adafruit_SSD1306 display(OLED_RESET);
const char* ssid = "имя сети";
const char* password = "пароль от вай-фая";
int ledPin = 13;
int timezone = 7 * 3600;
int dst = 0;
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Clear the buffer.
display.clearDisplay();
display.display();
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin,LOW);
Serial.begin(115200);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Wifi connecting to ");
display.println( ssid );
WiFi.begin(ssid,password);
display.println("\nConnecting");
display.display();
while( WiFi.status() != WL_CONNECTED ){
delay(500);
display.print(".");
display.display();
}
// Clear the buffer.
display.clearDisplay();
display.display();
display.setCursor(0,0);
display.println("Wifi Connected!");
display.print("IP:");
display.println(WiFi.localIP() );
display.display();
configTime(timezone, dst, "pool.ntp.org","time.nist.gov");
display.println("\nWaiting for NTP...");
while(!time(nullptr)){
Serial.print("*");
delay(1000);
}
display.println("\nTime response....OK");
display.display();
delay(1000);
display.clearDisplay();
display.display();
}
void loop() {
time_t now = time(nullptr);
struct tm* p_tm = localtime(&now);
Serial.print(p_tm->tm_mday);
Serial.print("/");
Serial.print(p_tm->tm_mon + 1);
Serial.print("/");
Serial.print(p_tm->tm_year + 1900);
Serial.print(" ");
Serial.print(p_tm->tm_hour);
Serial.print(":");
Serial.print(p_tm->tm_min);
Serial.print(":");
Serial.println(p_tm->tm_sec);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(p_tm->tm_hour);
display.print(":");
if( p_tm->tm_min <10)
display.print("0");
display.print(p_tm->tm_min);
display.setTextSize(2);
display.setCursor(90,5);
display.print(".");
if( p_tm->tm_sec <10)
display.print("0");
display.print(p_tm->tm_sec);
display.setTextSize(1);
display.setCursor(0,40);
display.print(p_tm->tm_mday);
display.print("/");
display.print(p_tm->tm_mon + 1);
display.print("/");
display.print(p_tm->tm_year + 1900);
display.display();
delay(1000); // update every 1 sec
}
aliexpress.com
0.98€ 20% OFF|Nieuwe Draadloze Module CH340 Nodemcu V3 Lua Wifi Internet Van Dingen Development Board Gebaseerd ESP8266|nodemcu…
Smarter Shopping, Better Living! Aliexpress.com
Простые часы на ESp8266 +Oled display
Для сборки потребуется :
Плата NodeMcu v3 https://alii.pub/5wwx2u
0.96" I2C OLED Display https://ali.pub/54jn2p
Провода для спайки
Код
#include
#include
#include
#include
#include
#include
#define OLED_RESET LED_BUILTIN //4
Adafruit_SSD1306 display(OLED_RESET);
const char* ssid = "имя сети";
const char* password = "пароль от вай-фая";
int ledPin = 13;
int timezone = 7 * 3600;
int dst = 0;
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Clear the buffer.
display.clearDisplay();
display.display();
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin,LOW);
Serial.begin(115200);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Wifi connecting to ");
display.println( ssid );
WiFi.begin(ssid,password);
display.println("\nConnecting");
display.display();
while( WiFi.status() != WL_CONNECTED ){
delay(500);
display.print(".");
display.display();
}
// Clear the buffer.
display.clearDisplay();
display.display();
display.setCursor(0,0);
display.println("Wifi Connected!");
display.print("IP:");
display.println(WiFi.localIP() );
display.display();
configTime(timezone, dst, "pool.ntp.org","time.nist.gov");
display.println("\nWaiting for NTP...");
while(!time(nullptr)){
Serial.print("*");
delay(1000);
}
display.println("\nTime response....OK");
display.display();
delay(1000);
display.clearDisplay();
display.display();
}
void loop() {
time_t now = time(nullptr);
struct tm* p_tm = localtime(&now);
Serial.print(p_tm->tm_mday);
Serial.print("/");
Serial.print(p_tm->tm_mon + 1);
Serial.print("/");
Serial.print(p_tm->tm_year + 1900);
Serial.print(" ");
Serial.print(p_tm->tm_hour);
Serial.print(":");
Serial.print(p_tm->tm_min);
Serial.print(":");
Serial.println(p_tm->tm_sec);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(p_tm->tm_hour);
display.print(":");
if( p_tm->tm_min <10)
display.print("0");
display.print(p_tm->tm_min);
display.setTextSize(2);
display.setCursor(90,5);
display.print(".");
if( p_tm->tm_sec <10)
display.print("0");
display.print(p_tm->tm_sec);
display.setTextSize(1);
display.setCursor(0,40);
display.print(p_tm->tm_mday);
display.print("/");
display.print(p_tm->tm_mon + 1);
display.print("/");
display.print(p_tm->tm_year + 1900);
display.display();
delay(1000); // update every 1 sec
}
Для сборки потребуется :
Плата NodeMcu v3 https://alii.pub/5wwx2u
0.96" I2C OLED Display https://ali.pub/54jn2p
Провода для спайки
Код
#include
#include
#include
#include
#include
#include
#define OLED_RESET LED_BUILTIN //4
Adafruit_SSD1306 display(OLED_RESET);
const char* ssid = "имя сети";
const char* password = "пароль от вай-фая";
int ledPin = 13;
int timezone = 7 * 3600;
int dst = 0;
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Clear the buffer.
display.clearDisplay();
display.display();
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin,LOW);
Serial.begin(115200);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Wifi connecting to ");
display.println( ssid );
WiFi.begin(ssid,password);
display.println("\nConnecting");
display.display();
while( WiFi.status() != WL_CONNECTED ){
delay(500);
display.print(".");
display.display();
}
// Clear the buffer.
display.clearDisplay();
display.display();
display.setCursor(0,0);
display.println("Wifi Connected!");
display.print("IP:");
display.println(WiFi.localIP() );
display.display();
configTime(timezone, dst, "pool.ntp.org","time.nist.gov");
display.println("\nWaiting for NTP...");
while(!time(nullptr)){
Serial.print("*");
delay(1000);
}
display.println("\nTime response....OK");
display.display();
delay(1000);
display.clearDisplay();
display.display();
}
void loop() {
time_t now = time(nullptr);
struct tm* p_tm = localtime(&now);
Serial.print(p_tm->tm_mday);
Serial.print("/");
Serial.print(p_tm->tm_mon + 1);
Serial.print("/");
Serial.print(p_tm->tm_year + 1900);
Serial.print(" ");
Serial.print(p_tm->tm_hour);
Serial.print(":");
Serial.print(p_tm->tm_min);
Serial.print(":");
Serial.println(p_tm->tm_sec);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print(p_tm->tm_hour);
display.print(":");
if( p_tm->tm_min <10)
display.print("0");
display.print(p_tm->tm_min);
display.setTextSize(2);
display.setCursor(90,5);
display.print(".");
if( p_tm->tm_sec <10)
display.print("0");
display.print(p_tm->tm_sec);
display.setTextSize(1);
display.setCursor(0,40);
display.print(p_tm->tm_mday);
display.print("/");
display.print(p_tm->tm_mon + 1);
display.print("/");
display.print(p_tm->tm_year + 1900);
display.display();
delay(1000); // update every 1 sec
}
aliexpress.com
0.98€ 20% OFF|Nieuwe Draadloze Module CH340 Nodemcu V3 Lua Wifi Internet Van Dingen Development Board Gebaseerd ESP8266|nodemcu…
Smarter Shopping, Better Living! Aliexpress.com
Простой водный бот на ардуино с блютуз управлением .
Ссылки на комплектующие :
Ардуино уно https://ali.pub/3n545h
Шилд для ардуино с драйвером L298 Driver https://ali.pub/3n55s7
HC-05 Bluetooth Module https://ali.pub/3n55wa
Прошивка
#include
SoftwareSerial BlueTooth(11, 12); // (TXD, RXD) of HC-06
char BT_input; // to store input character received via BT.
int speedpin=3;
int MotorRight1 = 5;
int MotorRight2 = 6;
int speedpin1=8;
int MotorLeft1 = 9;
int MotorLeft2 = 10;
void setup()
{
BlueTooth.begin(9600);
Serial.begin(9600);
pinMode(speedpin,OUTPUT);
pinMode(MotorRight1, OUTPUT);
pinMode(MotorRight2, OUTPUT);
pinMode(MotorLeft1, OUTPUT);
pinMode(MotorLeft2, OUTPUT);
pinMode(speedpin1,OUTPUT);
}
void loop()
{
if (BlueTooth.available())
{
BT_input=BlueTooth.read();
if (BT_input=='U')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,HIGH);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
}
else if (BT_input=='L')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,HIGH);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,HIGH);
}
else if (BT_input=='R')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,HIGH);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,HIGH);
digitalWrite(MotorLeft2,LOW);
}
else if (BT_input=='D')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,LOW);
digitalWrite(MotorRight2,HIGH);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
}
else if (BT_input=='X')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,LOW);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
}
}
}
Ссылки на комплектующие :
Ардуино уно https://ali.pub/3n545h
Шилд для ардуино с драйвером L298 Driver https://ali.pub/3n55s7
HC-05 Bluetooth Module https://ali.pub/3n55wa
Прошивка
#include
SoftwareSerial BlueTooth(11, 12); // (TXD, RXD) of HC-06
char BT_input; // to store input character received via BT.
int speedpin=3;
int MotorRight1 = 5;
int MotorRight2 = 6;
int speedpin1=8;
int MotorLeft1 = 9;
int MotorLeft2 = 10;
void setup()
{
BlueTooth.begin(9600);
Serial.begin(9600);
pinMode(speedpin,OUTPUT);
pinMode(MotorRight1, OUTPUT);
pinMode(MotorRight2, OUTPUT);
pinMode(MotorLeft1, OUTPUT);
pinMode(MotorLeft2, OUTPUT);
pinMode(speedpin1,OUTPUT);
}
void loop()
{
if (BlueTooth.available())
{
BT_input=BlueTooth.read();
if (BT_input=='U')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,HIGH);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
}
else if (BT_input=='L')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,HIGH);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,HIGH);
}
else if (BT_input=='R')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,HIGH);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,HIGH);
digitalWrite(MotorLeft2,LOW);
}
else if (BT_input=='D')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,LOW);
digitalWrite(MotorRight2,HIGH);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
}
else if (BT_input=='X')
{
analogWrite(speedpin,100);
analogWrite(speedpin1,100);
digitalWrite(MotorRight1,LOW);
digitalWrite(MotorRight2,LOW);
digitalWrite(MotorLeft1,LOW);
digitalWrite(MotorLeft2,LOW);
}
}
}
Датчик атмосферного давления, влажности и температуры BME280
US $2.08
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889
Модуль BME280 предназначен для измерения атмосферного давления, температуры и влажности. Это очередной датчик давления фирмы Bosch Sensortec для измерения атмосферного давления и температуры. По сравнению с первыми датчиками серии (BMP085 и BMP180) он имеет лучшие характеристики и меньшие размеры. Отличие от датчика BMP280 – наличие гигрометра, что позволяет измерять относительную влажность воздуха и создать на его основе маленькую метеостанцию.
#include
#include
// подключение библиотек
#include
#include
#include
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme280; // BME280 на I2C
OLED oled(SDA, SCL, 8); //
extern uint8_t SmallFont[]; // шрифт
unsigned long millist;
String txt1="";
void setup() {
Serial.begin(9600);
bme280.begin();
oled.begin();
oled.setFont(SmallFont);
}
void loop() {
// прошло 5 секунд?
if(millis()-millist>=5000) {
oled.clrScr();
// температура
txt1="Temp=";
txt1= txt1+String(bme280.readTemperature());
txt1= txt1+" *C";
oled.print(txt1, CENTER, 10);
// влажность
txt1="Hum=";
txt1= txt1+String(bme280.readHumidity());
txt1= txt1+" %";
oled.print(txt1, CENTER, 25);
// давление
txt1="P=";
txt1= txt1+String(bme280.readPressure() / 100.0F);
txt1= txt1+" hPa";
oled.print(txt1, CENTER, 40);
oled.update();
// новый отсчет 5 секунд
millist=millis();
}
}
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889&from_content=wall_-43363264_482771&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
US $2.08
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889
Модуль BME280 предназначен для измерения атмосферного давления, температуры и влажности. Это очередной датчик давления фирмы Bosch Sensortec для измерения атмосферного давления и температуры. По сравнению с первыми датчиками серии (BMP085 и BMP180) он имеет лучшие характеристики и меньшие размеры. Отличие от датчика BMP280 – наличие гигрометра, что позволяет измерять относительную влажность воздуха и создать на его основе маленькую метеостанцию.
#include
#include
// подключение библиотек
#include
#include
#include
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme280; // BME280 на I2C
OLED oled(SDA, SCL, 8); //
extern uint8_t SmallFont[]; // шрифт
unsigned long millist;
String txt1="";
void setup() {
Serial.begin(9600);
bme280.begin();
oled.begin();
oled.setFont(SmallFont);
}
void loop() {
// прошло 5 секунд?
if(millis()-millist>=5000) {
oled.clrScr();
// температура
txt1="Temp=";
txt1= txt1+String(bme280.readTemperature());
txt1= txt1+" *C";
oled.print(txt1, CENTER, 10);
// влажность
txt1="Hum=";
txt1= txt1+String(bme280.readHumidity());
txt1= txt1+" %";
oled.print(txt1, CENTER, 25);
// давление
txt1="P=";
txt1= txt1+String(bme280.readPressure() / 100.0F);
txt1= txt1+" hPa";
oled.print(txt1, CENTER, 40);
oled.update();
// новый отсчет 5 секунд
millist=millis();
}
}
https://aliclick.shop/r/c/1qvw6uhprx3n7bi9?product_id=1005002434252889&from_content=wall_-43363264_482771&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D