Cov txheej txheem:

SMS Text Temp Alerts Los ntawm ATTINY85 thiab A1 GSM: 5 Kauj Ruam
SMS Text Temp Alerts Los ntawm ATTINY85 thiab A1 GSM: 5 Kauj Ruam

Video: SMS Text Temp Alerts Los ntawm ATTINY85 thiab A1 GSM: 5 Kauj Ruam

Video: SMS Text Temp Alerts Los ntawm ATTINY85 thiab A1 GSM: 5 Kauj Ruam
Video: NLP with Python! Term Frequency-Inverse Document Frequency (tf-idf) 2024, Lub Xya hli ntuj
Anonim
SMS Text Temp Alerts Los ntawm ATTINY85 thiab A1 GSM
SMS Text Temp Alerts Los ntawm ATTINY85 thiab A1 GSM

Cov lus qhia no qhia koj yuav ua li cas ntsuas qhov ntsuas kub los ntawm qhov ntsuas kub yooj yim thiab xa nws los ntawm sms ntawv rau koj lub xov tooj ntawm tes. Txhawm rau ua kom yooj yim yam, Kuv xa qhov kub ntawm qhov teev tseg tab sis kuv tseem qhia yuav ua li cas qhov no tuaj yeem ua tiav tsuas yog kev zam / ceeb toom. Kho vajtse yog tus nqi qis heev, tsawg dua 10 daus las, txawm hais tias muaj tus nqi sms rov tshwm sim los xav txog.

Kev nqa hnyav yog ua los ntawm qhov yooj yim tab sis muaj zog ATTINY 85 uas ntes cov ntaub ntawv ntsuas kub thiab tom qab ntawd ua rau SMS xa los ntawm AI-Thinker A6 GSM module.

Hauv ntej, koj sau ATTINY85 cov cai hauv Arduino IDE ib puag ncig thiab hlawv nws ntawm ATTINY85 siv USBASP serial/USB hloov pauv. Kuv tau npog kev teeb tsa AI-Thinker A6 GSM module thiab Arduino IDE hauv ob qho kev qhia yav dhau los. Dab tsi txawv ntawm no yog cuam tshuam ATTINY thiab A6 GSM module siv kev sib txuas lus txuas.

www.instructables.com/id/How-to-Send-an-SM…https://www.instructables.com/id/15-Dollar-Attiny8…

Tom qab ua haujlwm, ATTINY nyeem cov ntaub ntawv ntsuas kub los ntawm lub ntsuas cua ntsuas cua - Dallas 18B20- thiab tom qab ntawd xa cov ntaub ntawv thiab cov lus txib los ntawm kev txuas txuas mus rau A6 GSM module uas tom qab ntawd xa nws li SMS xa mus rau koj lub xov tooj ntawm tes / ntse.

Nov yog yam koj xav tau:

1. USBASP serial/USB hloov pauv.

2. ATTINY 85.

3. AI-Thinker A6 GSM module version 6 (nrog lub sim uas muaj SMS khab nias).

4. 3.3v breadboard fais fab mov rau ATTINY85.

5. 3.3.v USB fais fab mov rau AI-Thinker A6 GSM module.

6. Dallas 18B20 ntsuas kub..

7. 4.7k resistor rau 18B20 sensor.

8. Creadboard thiab cables.

9. Arduino IDE (Kuv siv version 1.8.5. Rau qhov no).

10. Windows X laptop (Kuv siv version 10) nrog qhov chaw nres nkoj usb dawb.

Kauj Ruam 1: Ua Haujlwm ATTINY 85

Nov yog Arduino IDE code (Koj yuav tau hloov tus lej xov tooj uas koj xav xa SMS.)

#include #include #include

// *** // *** Txhais cov RX thiab TX pins. Xaiv ob qho // *** pins uas tsis siv. Sim ua kom tsis txhob D0 (tus pin 5) // *** thiab D2 (tus pin 7) yog tias koj npaj yuav siv I2C. // *** #define RX 3 // *** D3, Pin 2 #define TX 4 // *** D4, Pin 3

// *** // *** Txhais cov software raws li chaw nres nkoj txuas. Siv lub // *** npe Serial kom cov cai tuaj yeem siv rau lwm lub // *** platforms uas txhawb nqa kho vajtse raws tus lej. Ntawm // *** chips uas txhawb nqa cov khoom kho vajtse, tsuas yog // *** tawm tswv yim kab no. // ***

SoftwareSerial mySerial = SoftwareSerial (RX, TX);

// *** // *** Pinout ATtiny25/45/85: // *** PDIP/SOIC/TSSOP // *** ================== ====================================================================== ========================= // *** // *** (PCINT5/RESET/ADC0/dW) PB5 [1]*[8] VCC // *** (PCINT3/XTAL1/CLKI/OC1B/ADC3) PB3 [2] [7] PB2 (SCK/USCK/SCL/ADC1/T0/INT0/PCINT2) // *** (PCINT4/ XTAL2/CLKO/OC1B/ADC2) PB4 [3] [6] PB1 (MISO/DO/AIN1/OC0B/OC1A/PCINT1) // *** GND [4] [5] PB0 (MOSI/DI/SDA/AIN0 /OC0A/OC1A/AREF/PCINT0) // *** // ATTINY 85 zaus teeb tsa sab hauv 8 MHz

// *** // *** Pin uas OneWire cov ntaub ntawv // *** xaim txuas nrog. // *** #define ONE_WIRE_BUS 1

// *** // *** Teeb tsa ib qho piv txwv los sib tham nrog ib qho OneWire // *** khoom siv (tsis yog Maxim/Dallas kub ICs). // *** OneWire _oneWire = OneWire (ONE_WIRE_BUS);

// *** // *** Dhau peb cov lus siv ib qho rau Dallas Kub. // *** DallasTemperature _sensors = DallasTemperature (& _ oneWire);

void setup () {// *** // *** Initialize Serial port // *** mySerial.begin (115200); ncua (60000);

// *** Pib lub tsev qiv ntawv. _sensors.begin (); }

void voj () {

// *** // *** Tau txais qhov kub thiab txias tam sim no. // *** _sensors.requestTemperatures (); ncua (2000); ob npaug tempC = _sensors.getTempCByIndex (0); ob npaug tempF = _sensors.getTempFByIndex (0); // txheeb xyuas qhov ua yuam kev - qee zaum thaum pib, ntsuas pom zoo li 85C

yog (tempC 14 && tempC 18 && tempC = 23 && error_temperature) {SMS_temp (tempC, "sov heev");}}

tsis muaj dab tsi SMS_temp (ob npaug mytemp, hlua myalert) {mySerial.println ("AT+CMGF = 1"); // teeb tsa rau hom SMS ncua sijhawm (1000); mySerial.println ("AT+CMGF = 1"); // teeb tsa rau SMS hom ncua (1000); //mySerial.println("AT+CMGS=\"+YOG NUMBER / ""); // teeb tsa tus lej xov tooj (qhwv hauv ob nqe lus) ncua (1000); mySerial.print (mytemp, 1); mySerial.print (myalert); ncua (1000); mySerial.write (0x1A); // xa ctrl+z xaus lus ncua (1000); mySerial.write (0x0D); // Carriage Return in Hex ncua (1000); mySerial.write (0x0A); ncua (1000000); // 17 feeb - kho kom haum rau koj tus kheej daim ntawv thov}

Qhib Arduino IDE ib puag ncig - Kuv tau piav qhia yuav ua li cas thiaj pom koj txoj hauv kev ib puag ncig hauv qhov no hauv kuv cov lus qhia yav dhau los uas kuv tau hais ua ntej.

Koj yuav xav tau cov tsev qiv ntawv hauv qab no

SoftwareSerial.h. Hauv

OneWire.h

DallasTemperature.h

Tom ntej no, teeb tsa RX thiab TX pins ntawm ATTINY85 uas koj xav tau txuas nrog A1 Thinker. ATTINY 85 muaj 8 tus pin, plaub ntawm txhua sab thiab tau sib koom ua ke siv tus lej ntawm saum npoo a s siv. Tus Pin 1 lossis RESET tus pin nyob ntawm sab xub ntiag.

(qhov xwm txheej no kuv xaiv Pin2 thiab 3 - Cov no nyob ntawm ib sab ib yam li RESET tus pin uas nyob ib sab ntawm tus lej ntawm ATTINY 85. Tus Pin 2 yog tus pin txuas tom ntej los ntawm RESET tus pin thaum Pin 3 yog nruab nrab ntawm Pin 2 thiab GROUND)

Tom ntej no, koj yuav tsum teeb tsa qhov ntsuas kub -

#define ONE_WIRE_BUS 1

OneWire _oneWire = OneWire (ONE_WIRE_BUS);

DallasTemperature _sensors = DallasTemperature (& _ oneWire);

Tom ntej teeb tsa lub software serial chaw nres nkoj

mySerial.begin (115200);

ncua (60000);

thiab tom qab ntawd hu rau lub ntsuas nrog _sensors.begin ();

Ntxiv mus, muaj lub voj, uas pov npav ib puag ncig ntawm lub sijhawm tau txiav txim ua ntej, sau qhov ntsuas kub thiab xa xov / ceeb toom nyob ntawm tus nqi. Nws siv lub luag haujlwm SMS_temp uas tseem yog qhov uas koj teev sijhawm ntawm lub voj

lub voj void () {sensors.requestTemperatures (); ncua (2000);

ob npaug tempC = _sensors.getTempCByIndex (0);

ob npaug tempF = _sensors.getTempFByIndex (0);

yog tias (tempC <= 14) {SMS_temp (tempC, "Ua rau txias heev");}

yog (tempC> 14 && tempC <= 18) {SMS_temp (tempC, "Zoo heev");}

yog (tempC> 18 && tempC <23) {SMS_temp (tempC, "Temp Just right");}

yog (tempC> = 23 && error_temperature) {SMS_temp (tempC, "sov heev");}

}

==============

Tom ntej no, teeb tsa Arduino IDE txhawm rau npaj rau xa mus rau ATTINY85.

Ib tug xov tooj ntawm yam yuav tsum nco ntsoov

1- Yog tias koj tsis muaj ATTINY tsev neeg ntawm cov laug cam, ntxiv cov url hauv qab no https://raw.githubusercontent.com/damellis/attiny/… hauv File/Preferences/Ntxiv Boards Manager URL, Tom ntej no, hauv Arduio IDE nyem rau ntawm Cov Cuab Yeej/Pawg Thawj Coj/Pawg Thawj Coj thiab tshawb rau ATTINY thiab teeb tsa lub rooj tsav xwm tshiab. Hloov cov txheej txheem rau Attiny85.

Kauj Ruam 2: Tshaj Tawm Txoj Haujlwm rau ATTINY85

Rub tawm Txoj Haujlwm rau ATTINY85
Rub tawm Txoj Haujlwm rau ATTINY85

Tsis tas li, xa mus rau kuv cov lus qhia yav dhau los ntawm no-https://www.instructables.com/id/15-Dollar-Attiny8…

ATTINY85 muaj ob hom, kev ua haujlwm thiab hom haujlwm, feem. 1. PROGRAMMING MODE Ua ntej, txheeb xyuas tus pin ntawm ATTINY85. Txhawm rau ua qhov no, nrhiav qhov me me ntawm lub nti uas nyob ib sab ntawm RST/RESET tus pin. Siv qhov no los ua tus taw tes siv, koj tuaj yeem txheeb xyuas cov pins uas seem. Tag nrho cov ntaub ntawv no tau muab hauv A85 cov ntaub ntawv -https://ww1.microchip.com/downloads/en/DeviceDoc/At…

USBasp thiab ATTINY85 yuav tsum txuas nrog raws li qhia hauv daim duab saum toj no.

Tom ntej, ntawm Arduino IDE, teeb tus programmer rau USBasp thiab zaus mus rau sab hauv 8Mhz.

Txuas USBasp rau USB chaw nres nkoj ntawm koj lub laptop (Ntawm Windows 10, yog tias koj tsis muaj USBasp tsav tsheb siv Zadig raws li lub vev xaib

Tom ntej no, nrog USBasp txuas nrog, xaiv los ntawm Arduino IDE Sketch/upload thiab vam tias koj yuav tsum pom qhov kev nthuav qhia tso tawm pom hauv cov ntawv liab ntawm Arduino IDE thiab xaus nrog avrdude ua tiav. Ua tsaug.

Txhua qhov ua yuam kev ntawm theem no yog txhua qhov cuam tshuam nrog cov xaim xaim lossis tus tsav tsis raug.

Kauj Ruam 3: Khiav Koj Txoj Haujlwm

Khiav Koj Txoj Haujlwm
Khiav Koj Txoj Haujlwm
Khiav Koj Txoj Haujlwm
Khiav Koj Txoj Haujlwm
Khiav Koj Txoj Haujlwm
Khiav Koj Txoj Haujlwm

Ua ntej, qee yam hais txog Dallas 18b20 tus pas ntsuas kub. Nws muaj 3 tus pin, Hauv av (G), cov ntaub ntawv (D) thiab VCC raws li qhia hauv daim duab saum toj no. Rau kev ua haujlwm, nws yuav tsum tau txuas D thiab VCC nrog 4.7k resistor. G thiab VCC tau txuas nrog rau tus ncej tus kheej thaum D txuas nrog ATTINY 85, tus pin - [6] PB1, raws li teeb tsa hauv txoj cai.

Tom ntej no, txuas ATTINY rau A6 GSM raws li hauv qab no (thiab pom saum toj no)

ATTINY TX A6 UART_RXdATTINY RX A6 UART_TXd

ATTINY GND A6 GND

thiab ntawm A6 nws tus kheej, A6 PWR A6 VCC 5.0A6 RST A6 GND (Tsis txhob txuas rau hauv av !!!!!)

Tam sim no fais fab tuag rau ob lub cuab yeej, thiab tom qab ob peb feeb, kov ib ntus A6 tus pin hauv av nrog cov xov txuas nrog rau A6 RST tus pin. A6 yuav kaw thiab qhib thiab cia siab tias, koj yuav tsum tau txais cov ntaub ntawv kub ntawm koj lub xov tooj sai.

Kauj ruam 4: Xaus

Cov lus qhia no yuav zoo li yooj yim tab sis lub tswv yim yog qhia txog yam yuav ua tiav nrog cov nqi qis. Pom tseeb, yog tias koj nkag tau rau wi-fi lossis BLE hub ces muaj cov kev daws teeb meem uas tsim nyog dua.

Kuv tsis tau npog lwm qhov kev ua haujlwm xws li xa SMS mus rau lub xov tooj kom pib ntsuas kub / sib kis thiab lwm yam.

Pom zoo: