-
Notifications
You must be signed in to change notification settings - Fork 37
How to setup the environment?
Shawn edited this page Feb 3, 2020
·
1 revision
You will need to set up on Arduino and also on your Raspberry Pi. Let's assume we use Arduino Nano, the idea is the same if you use different model of Arduino. The steps below will set up the environment to read DHT sensor from Python.
- Access the repository at: https://github.com/uugear/UUGear and download the project. Extract the files and open the Arduino/UUGear folder.
- Open the UUGear.ino file in Arduino IDE, and verify the file compiles.
- Connect Arduino Nano board to USB port.
- Set IDE Tools | Board -> Arduino Nano w/ATmega328.
- Set IDE Tools | Serial Port -> whatever is newly listed after you connect the board.
- Upload the Sketch to the Nano
- Launch Serial Monitor from Tools | Serial Monitor
- Set Baud rate 115500
- Set Line feed to Both NL & CR
- Enter "U01" and hit send, should return "1UUGear-Arduino-####-####:)", where ####-#### is your nano ID.
- Copy the number returned by the Serial Monitor.
- Connect Arduino Nano board to Raspberry Pi and power on the Pi.
- Open the local UUGear folder and copy the RaspberryPi folder to the Pi. You can use FileZilla.
- Go to the RaspberryPi folder.
- Run "sh build.sh". This should create the bin folder.
- Go to the bin folder.
- Run "./lsuu"
- You should see the same Nano ID produced by the Serial Monitor.
- Create a new folder for your project somewhere on the Pi.
- Change to the RaspberryPi/example/python folder.
- Copy the ReadDHT.py file to your project folder.
- Go to the RaspberryPi/bin folder.
- Copy the files UUGear.py, libUUGear.so and UUGearDaemon to your project folder.
- Go to your project folder.
- Edit the ReadDHT.py file and change the Nano ID, to the one you copied from above, in the line: "device = UUGearDevice('UUGear-Arduino-####-####')"
- Enter "sudo python ReadDHT.py".
You should see the Humidity and Temperature displayed every second for 200 seconds.