Тензометрические датчики на 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
Простой водный бот на ардуино с блютуз управлением .
Ссылки на комплектующие :
Ардуино уно 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);
}
}
}
Простые часы на 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
MQ-135 Gas Sensor - это простой в использование датчик газа, широко применяются в робототехнике и системах автоматизации, подходит для Arduino проектов. Еще его называют датчик углекислого газа.
US $0.91
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738
#define RLOAD 22.0
#include "MQ135.h"
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
MQ135 gasSensor = MQ135(A0);
int val;
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.display();
}
void loop() {
val = analogRead(A0);
Serial.print ("raw = ");
Serial.println (val);
// float zero = gasSensor.getRZero();
// Serial.print ("rzero: ");
//Serial.println (zero);
float ppm = gasSensor.getPPM();
Serial.print ("ppm: ");
Serial.println (ppm);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(18,43);
display.println("CO2");
display.setCursor(63,43);
display.println("(PPM)");
display.setTextSize(2);
display.setCursor(28,5);
display.println(ppm);
display.display();
display.clearDisplay();
delay(2000);
}
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738&from_content=wall_-107877557_124033&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
US $0.91
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738
#define RLOAD 22.0
#include "MQ135.h"
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
MQ135 gasSensor = MQ135(A0);
int val;
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.display();
}
void loop() {
val = analogRead(A0);
Serial.print ("raw = ");
Serial.println (val);
// float zero = gasSensor.getRZero();
// Serial.print ("rzero: ");
//Serial.println (zero);
float ppm = gasSensor.getPPM();
Serial.print ("ppm: ");
Serial.println (ppm);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(18,43);
display.println("CO2");
display.setCursor(63,43);
display.println("(PPM)");
display.setTextSize(2);
display.setCursor(28,5);
display.println(ppm);
display.display();
display.clearDisplay();
delay(2000);
}
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738&from_content=wall_-107877557_124033&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
aliexpress.ru
MQ-135 Air quality and hazardous gas detection sensor alarm module MQ135 module | Электронные компоненты и принадлежности | АлиЭкспресс
MQ-135 Air quality and hazardous gas detection sensor alarm module MQ135 module, Наслаждайся ✓Бесплатная доставка по всему миру! ✓Предложение ограничено по времени! ✓Удобный возврат!
MQ-135 Gas Sensor - это простой в использование датчик газа, широко применяются в робототехнике и системах автоматизации, подходит для Arduino проектов. Еще его называют датчик углекислого газа.
US $0.91
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738
#define RLOAD 22.0
#include "MQ135.h"
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
MQ135 gasSensor = MQ135(A0);
int val;
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.display();
}
void loop() {
val = analogRead(A0);
Serial.print ("raw = ");
Serial.println (val);
// float zero = gasSensor.getRZero();
// Serial.print ("rzero: ");
//Serial.println (zero);
float ppm = gasSensor.getPPM();
Serial.print ("ppm: ");
Serial.println (ppm);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(18,43);
display.println("CO2");
display.setCursor(63,43);
display.println("(PPM)");
display.setTextSize(2);
display.setCursor(28,5);
display.println(ppm);
display.display();
display.clearDisplay();
delay(2000);
}
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738&from_content=wall_-43363264_503668&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
US $0.91
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738
#define RLOAD 22.0
#include "MQ135.h"
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
MQ135 gasSensor = MQ135(A0);
int val;
int sensorPin = A0;
int sensorValue = 0;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
display.begin(SSD1306_SWITCHCAPVCC);
display.clearDisplay();
display.display();
}
void loop() {
val = analogRead(A0);
Serial.print ("raw = ");
Serial.println (val);
// float zero = gasSensor.getRZero();
// Serial.print ("rzero: ");
//Serial.println (zero);
float ppm = gasSensor.getPPM();
Serial.print ("ppm: ");
Serial.println (ppm);
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(18,43);
display.println("CO2");
display.setCursor(63,43);
display.println("(PPM)");
display.setTextSize(2);
display.setCursor(28,5);
display.println(ppm);
display.display();
display.clearDisplay();
delay(2000);
}
https://aliclick.shop/r/c/1r0ry1kr5ysnxijo?product_id=32728440738&from_content=wall_-43363264_503668&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
aliexpress.ru
MQ-135 Air quality and hazardous gas detection sensor alarm module MQ135 module | Электронные компоненты и принадлежности | АлиЭкспресс
MQ-135 Air quality and hazardous gas detection sensor alarm module MQ135 module, Наслаждайся ✓Бесплатная доставка по всему миру! ✓Предложение ограничено по времени! ✓Удобный возврат!
Тензометрические датчики на 1-10 кг , а так же плата преобразователь АЦП HX711 AD для сборки весов.
US $4.18
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976
Весы на ардуино :
#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();
}
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976&from_content=wall_-107877557_127103&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
US $4.18
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976
Весы на ардуино :
#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();
}
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976&from_content=wall_-107877557_127103&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
Тензометрические датчики на 1-10 кг , а так же плата преобразователь АЦП HX711 AD для сборки весов.
US $4.18
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976
Весы на ардуино :
#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();
}
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976&from_content=wall_-43363264_522391&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
US $4.18
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976
Весы на ардуино :
#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();
}
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976&from_content=wall_-43363264_522391&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
Датчик атмосферного давления, влажности и температуры 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_-107877557_134072&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_-107877557_134072&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
Простые часы на ESp8266 +Oled display
Для сборки потребуется :
Плата NodeMcu v3 https://alli.pub/6ca8io
0.96" I2C OLED Display https://alli.pub/6ca8iv
Провода для спайки
Код
#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://alli.pub/6ca8io
0.96" I2C OLED Display https://alli.pub/6ca8iv
Провода для спайки
Код
#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.82US $ 25% OFF|New Wireless Module Ch340 Nodemcu V3 Lua Wifi Internet Of Things Development Board Based Esp8266 - Integrated…
Smarter Shopping, Better Living! Aliexpress.com
👍4👎1
Датчик атмосферного давления, влажности и температуры 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_556423&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_556423&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
👍2
Название проекта: О'кей Google, Сезам, открой дверь
Платформа: Arduino
Описание:
В проекте реализовано открывание двери с помощью голосовой команды. Чтобы попасть в дом, нужно просто сказать: "Сезам, откройся".
Использованные компоненты: Arduino UNO, cерводвигатель , Bluetooth-модуль HC-05
Купить комплектующие на Алиэкспресс :
Сервопривод https://aliclick.shop/r/c/1r4jf5zc7fwoz4bw?product_id=1005001265737959
Arduino uno r3 https://aliclick.shop/r/c/1r4jf6t3ou7yo90h?product_id=1005002379248792
Bluetooth HC-05 https://aliclick.shop/r/c/1r4jf8z62a6ii0km?product_id=32786773297
Сайт проекта: https://dheera.net/projects/sesame
Отличный DIY-проект, в котором использована базовая схема подключения серводвигателя к arduino. Сделай сам умный дом и интернет вещей.
Для разблокирования дверей студент MIT использовал команды Google Now.
Мейкер создал приложение для мобильных устройств, которое окрестили именем «Сезам». Теперь чтобы открыть дверь, ему нужно просто произнести слова: "О'кей Google, Сезам, откройся". Приложение, установленное на android-часах, которые он носит на запястье, отдает команду дверному замку.
Для реализации идеи на двери размещены: плата Arduino Uno (ATmega328), bluetooth-модуль и сервопривод. Сервопривод прикреплен к дверной защелке, а модуль bluetooth ожидает сигнал и при его получении отдает команду arduino через serial-порт. Arduino в свою очередь отдает команду сервоприводу.
Скетч для ардуино
#include
#define SERVO_PIN 9
Servo servo;
void setup() {
Serial.begin(9600);
}
void loop() {
char inputLine[200];
int bytesRead;
String argv[10];
char* i;
if (Serial.available()) {
bytesRead=Serial.readBytesUntil('n',inputLine,200);
inputLine[bytesRead]=0;
if(inputLine[bytesRead-1]=='r') inputLine[bytesRead-1]=0;
argv[0]=strtok_r(inputLine," ",&i);
argv[1]=strtok_r(NULL," ",&i);
if(argv[0]=="ping") {
Serial.write("pongrn");
} else if(argv[0]=="write") {
servo.attach(SERVO_PIN);
servo.write(argv[1].toInt());
delay(2000);
servo.detach();
}
}
}
https://youtu.be/JfZt8_a6fVY
https://alii.pub/5qsovr
Платформа: Arduino
Описание:
В проекте реализовано открывание двери с помощью голосовой команды. Чтобы попасть в дом, нужно просто сказать: "Сезам, откройся".
Использованные компоненты: Arduino UNO, cерводвигатель , Bluetooth-модуль HC-05
Купить комплектующие на Алиэкспресс :
Сервопривод https://aliclick.shop/r/c/1r4jf5zc7fwoz4bw?product_id=1005001265737959
Arduino uno r3 https://aliclick.shop/r/c/1r4jf6t3ou7yo90h?product_id=1005002379248792
Bluetooth HC-05 https://aliclick.shop/r/c/1r4jf8z62a6ii0km?product_id=32786773297
Сайт проекта: https://dheera.net/projects/sesame
Отличный DIY-проект, в котором использована базовая схема подключения серводвигателя к arduino. Сделай сам умный дом и интернет вещей.
Для разблокирования дверей студент MIT использовал команды Google Now.
Мейкер создал приложение для мобильных устройств, которое окрестили именем «Сезам». Теперь чтобы открыть дверь, ему нужно просто произнести слова: "О'кей Google, Сезам, откройся". Приложение, установленное на android-часах, которые он носит на запястье, отдает команду дверному замку.
Для реализации идеи на двери размещены: плата Arduino Uno (ATmega328), bluetooth-модуль и сервопривод. Сервопривод прикреплен к дверной защелке, а модуль bluetooth ожидает сигнал и при его получении отдает команду arduino через serial-порт. Arduino в свою очередь отдает команду сервоприводу.
Скетч для ардуино
#include
#define SERVO_PIN 9
Servo servo;
void setup() {
Serial.begin(9600);
}
void loop() {
char inputLine[200];
int bytesRead;
String argv[10];
char* i;
if (Serial.available()) {
bytesRead=Serial.readBytesUntil('n',inputLine,200);
inputLine[bytesRead]=0;
if(inputLine[bytesRead-1]=='r') inputLine[bytesRead-1]=0;
argv[0]=strtok_r(inputLine," ",&i);
argv[1]=strtok_r(NULL," ",&i);
if(argv[0]=="ping") {
Serial.write("pongrn");
} else if(argv[0]=="write") {
servo.attach(SERVO_PIN);
servo.write(argv[1].toInt());
delay(2000);
servo.detach();
}
}
}
https://youtu.be/JfZt8_a6fVY
https://alii.pub/5qsovr
👍1
Тензометрические датчики на 1-10 кг , а так же плата преобразователь АЦП HX711 AD для сборки весов.
US $4.18
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976
Весы на ардуино :
#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();
}
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976&from_content=wall_-43363264_566104&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
US $4.18
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976
Весы на ардуино :
#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();
}
https://aliclick.shop/r/c/1r394cm6octwuus9?product_id=4000272063976&from_content=wall_-43363264_566104&gaid=bfc0fd12-544f-4bc8-96c7-c6e5f5a06353&sns_params=%7B%22vk_id%22%3A10943591%2C%22exps%22%3A%5B%5D%7D
Простой водный бот на ардуино с блютуз управлением .
Ссылки на комплектующие :
Ардуино уно 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
Ссылки на комплектующие :
Ардуино уно 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
Графический дисплей 12864, 12864-06D, 12864, ЖК-модуль
https://ali.pub/6lth0q
Весёлый дисплейчик, серый вариант хорошо читается и без подсветки. Рамки конские, но жить можно) . Инициализировал для меги как
#include <U8g2lib.h>
U8G2_ST7565_ERC12864_ALT_F_4W_SW_SPI u8g2(U8G2_R0,/* clock=*/ 53, /* data=*/ 47, /* cs=*/ 48, /* dc=*/ 49, /* reset=*/ 52);
u8g2.setContrast (70);
https://ali.pub/6lth0q
https://ali.pub/6lth0q
Весёлый дисплейчик, серый вариант хорошо читается и без подсветки. Рамки конские, но жить можно) . Инициализировал для меги как
#include <U8g2lib.h>
U8G2_ST7565_ERC12864_ALT_F_4W_SW_SPI u8g2(U8G2_R0,/* clock=*/ 53, /* data=*/ 47, /* cs=*/ 48, /* dc=*/ 49, /* reset=*/ 52);
u8g2.setContrast (70);
https://ali.pub/6lth0q