Cov txheej txheem:
Video: EnergyChain: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:30
/ * Ua haujlwm tseem tab tom ua haujlwm */
Lub Zog Hluav Taws Xob yog POC uas ua ke IOT thiab Blockchain.
Qhov peb tau tso cai rau tib neeg muag lub zog uas lawv tsim rau leej twg yam tsis muaj qib xav tau. Txhawm rau kom muaj kev nyab xeeb ntawm tus tsim khoom thiab tus neeg siv khoom, tus neeg siv khoom tuaj yeem txuas txhua yam nws xav tau ntawm nws thiab tau txais lub zog. Lub npov ntsuas tus nqi siv tam sim no thiab sau qhov sib npaug
Kauj ruam 1: Cov ntaub ntawv
Txhawm rau ua cov phiaj xwm no peb yuav siv:
- 1 Raspberry Pi Zero
- 1 qhov ntsuas tam sim no AS712 (20A)
- 1 ADC 16 ntsis I2C ADS1555
- 1 RFID sensor RC522
- 1 relay 5V
- 1AC/DC 5V/2A hloov pauv ECL10US05-E los ntawm Farnell
- 1 qhov hluav taws xob
Kauj ruam 2: Kev thaiv kab
Peb yuav tsum tau xaim txhua yam ua ke raws li nws tau qhia hauv daim duab, ceev faj rau tam sim no xa los ntawm Raspberry Pi.
Cov kab hais kom ua:
- 3v3 Hwj chim - Txuas 5V Vcc/Tam Sim No Sensor Vcc/RFID Vcc/ADC Vcc
- 5v Hwj chim - AC/DC hloov pauv 5v
- Hauv av - Siv 5V GND/Tam Sim No Sensor GND/AC/DC hloov GND/RFID GND/ADC cov tswv yim thiab tso tawm GND
- BCM 2 - ADC SDA
- BCM 3 - ADC SCL
- BCM 4 - ADC CLK
- BCM 6 - RFID SDA
- BCM 9 - RFID MISO
- BCM 10 - MOSI RFID
- BCM 11 - RFID SCK
- BCM 17 - Tshaj Tawm 5V IN
- BCM 24 - Pib RFID
- BCM 25 - RFID RST
Kauj ruam 3: Code
Txoj cai no ua haujlwm raws li hauv qab no:
RFID sensor tos rau ib daim ntawv thiab sau nws hauv Terminal. Then lub ntsuas tam sim no ntsuas tus nqi AC tam sim no siv thiab tso tawm hauv lub davhlau ya nyob twg lub zog tam sim ntawd txhua 100 ntsuas. Ua tsaug rau qhov ntawd, peb tuaj yeem tau txais tus nqi kWh.
ntshuam ntsaws, json
ntshuam sys los ntawm xov ntshuam ntshuam Xov los ntawm pirc522 ntshuam RFID ntshuam RPi. GPIO li GPIO ## Ntshuam GPIO tsev qiv ntawv ntshuam teeb liab ntshuam lub sijhawm ntshuam Adafruit_ADS1x15 GPIO.setmode (GPIO. BOARD) GPIO.setup (11, GPIO. OUT) GPIO.output (11, Tseeb) rdr = RFID () siv = rdr.util () siv.debug = Tseeb TCP_IP = '172.31.29.215' TCP_PORT = 5000 BUFFER_SIZE = 1024 adc = Adafruit_ADS1x15. ADS1115 () def end_read (teeb liab, thav duab): thoob ntiaj teb khiav print ("\ nCtrl+C ntes, xaus nyeem.") khiav = Cuav rdr.cleanup () sys.exit () signal.signal (signal. SIGINT, end_read) def loopRead (s): DemandeTag = 1 DemandeMesure = 0 bol = Muaj tseeb thaum (bol): yog DemandeTag == 1: tag () DemandeTag = 0 DemandeMesure = 1 yog DemandeMesure == 1: Mesure2 () sim: data = s.recv (BUFFER_SIZE) yog tias tsis yog cov ntaub ntawv: tawg cov ntaub ntawv luam tawmJSON = json.loads (cov ntaub ntawv) yog "cov lus" hauv cov ntaub ntawv JSON: luam tawm cov ntaub ntawv JSON ['lus'] yog cov ntaub ntawv JSON ['xov'] == "tawm": luam tawm ('Tawm qhov xav tau') GPIO.output (11, GPIO. HIGH) DemandeTag = 0 DemandeMesure = 0 bol = False yog dataJSON ['message'] == "on": GPIO.output (11, GPIO. LOW) DemandeMesure = 1 DemandeTag = 1 yog dataJSON ['message'] == "off": GPIO.output (11, GPIO. HIGH) DemandeTag = 1 message = '' zam tshwj tsis yog e: txuas ntxiv s.close () def tag (): rdr.wait_for_tag () (yuam kev, cov ntaub ntawv) = rdr.request () time.sleep (0.25) (yuam kev, uid) = rdr.anticoll () ID = str (uid [0])+'. '+str (uid [1])+'. '+str (uid [2])+'. '+str (uid [3]) print ("Card nyeem UID:"+ID) GPIO.output (11, GPIO. LOW) def Mesure (): mesure_voltage = 0 Nbre_mesure = 100 i = 0 thaum kuv def Mesure2 (): mesure_voltage = 0 Nbre_mesure = 200 max_voltage = 0 min_voltage = 32768 mVparAmp = 100 Puissance = 0 i = 0 readValue = 0 thaum imax_voltage: max_voltage = readValue yog readValue def Mesure3 (): print (str (adc.read_adc (0, nce = 1))) yog _name_ == "_main_": s = socket.socket (socket. AF_INET, socket. SOCK_STREAM) #s.connect ((TCP_IP, TCP_PORT)) #s.setblocking (0) loopRead (s)
Kauj ruam 4: Lub thawv
Txhawm rau ua txhua yam khoom siv hluav taws xob ntau dua, peb tsim lub thawv uas yuav muaj txhua yam hauv. Txhawm rau ntsia hlau rau txhua yam peb yuav siv M3 ntsia hlau.
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
Tsev Automation Kauj Ruam ntawm Kauj Ruam Siv Wemos D1 Mini Nrog PCB Tsim: 4 Kauj Ruam
Tsev Automation Kauj Ruam Ib Leeg Siv Wemos D1 Mini Nrog PCB Tsim: Tsev Automation Kauj Ruam los ntawm Kauj Ruam siv Wemos D1 Mini nrog PCB Tsim cov tub ntxhais kawm ntawv qib siab. Tom qab ntawd ib tus ntawm peb cov tswv cuab tuaj
RC Taug Qab Neeg Hlau Siv Arduino - Kauj Ruam Ib kauj ruam: 3 Kauj Ruam
RC Tracked Robot Siv Arduino - Kauj Ruam Ib Nrab: Hav guys, Kuv rov qab los nrog lwm tus neeg hlau txias chassis los ntawm BangGood. Vam tias koj tau dhau los ntawm peb cov phiaj xwm yav dhau los - Spinel Crux V1 - Tus Cwj Pwm Tswj Tus Neeg Hlau, Spinel Crux L2 - Arduino Xaiv thiab Muab Neeg Hlau nrog Robotic caj npab thiab Badland Braw
Kawm Yuav Ua Li Cas Kos Tus Tswm Ciab - Kauj Ruam Ib Kauj Ruam: 6 Kauj Ruam
Kawm Yuav Ua Li Cas Thiaj Li Tswmciab - Kauj Ruam Ib kauj ruam: Cov tswm ciab no siv sijhawm 10 feeb los kos yog tias koj ua raws kuv cov kauj ruam ua tib zoo
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: 9 Kauj Ruam
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: Cov ntawv qhia no yog qhia koj yuav tsim lub Caj Npab Caj Npab ntawm koj tus kheej li cas