Skip to content

Example of using Python to interact with I2C sensor with Firmata to read data from the Atmega32u4 controller and publish the smae using MT7688 MPU available in the Linkit7688 DUO module.

Notifications You must be signed in to change notification settings

WGLabz/Linkit7688-Python-Firmata-MQTT-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DHT12 Connection Diagram:-

Imgge

Dependencies:-

  1. Firmata library for Python Pymata
    pip install pymata
    
  2. MQTT Client Library for Python Eclipse Paho
    pip install paho-mqtt
    

Run on Boot:-

To make the Python script run on boot I have used InitScripts, to creare the job follow the following commands, (Its a basic script and doesnot have error handling and all)

vi /etc/init.d/dht12

Paste the followinf content,

#!/bin/sh /etc/rc.common

START=98

start(){
        ubus  -t 60 wait_for network.interface network.interface.loopback # Makes sure network is up
        echo "Starting the DHT12 Sensor Script"
        python /root/sensor.py &
}

Make the file executable and enable it,

chmod +x /etc/init.d/dht12
/etc/init.d/dht12 enable

Now you can reboot the module and can see the sensor data getting published to the provided topic.

About

Example of using Python to interact with I2C sensor with Firmata to read data from the Atmega32u4 controller and publish the smae using MT7688 MPU available in the Linkit7688 DUO module.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published