*Total -- 580.77kb -> 563.65kb (2.95%) /img/j.jpeg -- 42.37kb -> 40.30kb (4.9%) /img/b.jpeg -- 43.50kb -> 41.62kb (4.32%) /img/a.jpeg -- 48.63kb -> 46.68kb (3.99%) /img/k.jpeg -- 50.17kb -> 48.36kb (3.62%) /img/d.jpeg -- 43.36kb -> 41.95kb (3.25%) /img/g.jpeg -- 55.23kb -> 53.44kb (3.24%) /img/f.jpeg -- 70.02kb -> 68.02kb (2.85%) /img/h.jpeg -- 65.39kb -> 63.63kb (2.69%) /img/i.jpeg -- 57.53kb -> 56.35kb (2.05%) /img/fritzing_bb.jpeg -- 104.58kb -> 103.31kb (1.22%) Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
smart-farm-africastalking-hackathon
Project, smart farm, to be demoed at africastalking hackathon for their eris V1 dev kit.
Introduction
Hardware
Basically this is prototype device for smart farming. The smart farm has DHT11 sensor which measures temperature and humidity, light dependent resistor whihc measures light intensity and soil moisture sensor which measures soil moisture content. We have and irrigation system and fan system symbolized by a solid state relay. When the soil moisture is low the eris dev kit automatically starts the irrigation system to raise the soil moisture content. If the soil moisture raises until it reaches a certain level the irrigation system is closed. When the temperature is high the fan and irrigation system are turned on in order to reduce the temperature of the micro climate. If it drops to a certain level the two systems are stopped. When the humidity is low the irrigation system which is overhead the crops is started in order to raise the humidity to optimum levels. If it is high the irrigation system is stopped. For light intensity we are tracking the records to be able to make better decisions in the future maybe by data analysis.
The micro controller generally measures all the paramters after every minute and sends it to the africa's talking IoT API. Meanwhile the date is also shown on an oled screen on the eris dev kit. For sending the data we are using MQTT protocol and we are sending it via the network of Safaricom. This is to meand that the eris dev kit has a Preconfigured sim card to send data to Africa's Talking API.
Backend App
This is the callback applications which listens to all the incoming and is also repsonsible for outgowing messages. This applications has USSD and SMS services for the farming. In the future I will implement a voice applications. The USSD app is responsible for displaying the data of the farm to the user. It has wide range of use cases spanning from getting data from any date to starting or stoping irrigation. The sms service sends a daily average at the end of the day and also sends alert on any extreme conditions.
Usage
Build ther arduino file
Third Party Libraries
| Library | Function | Source |
|---|---|---|
| MQTT Client(Eclipse) | Handling MQTT Client Connection | Eclipse.org |
| Tiny GSM | Handling GSM Module connection | TinyGSM |
| DHT | High level wrapper for DHT sensors | Adafruit |
| U8x8lib | High level wrapper for OLED display | olikraus/u8g2 |
- Go to
Hardware/hardwareappthen create aconfig.hfile. This will hold you config Variables - Inside the
config.hadd
// This is your application username that is associated with your IoT Appplication
#define APPLICATION_USERNAME "rodneydemo"
// This is the device group that the IoT device is to connect to
#define DEVICE_GROUP_NAME "rodneygroup"
// This is the device identifier that is sent to the Africa's Talking Broker
#define DEVICE_ID "rodneykit"
// This is the devive group password that the IoT device is to use to establish a connection
#define DEVICE_GROUP_PASSWORD "$%rodneypassword$%"
// This will resolve to <username>:<device-group>
#define MQTT_CREDENTIALS APPLICATION_USERNAME ":" DEVICE_GROUP_NAME
// This will always start with <username>/<device-group>/
#define TOPIC_PREFIX APPLICATION_USERNAME "/" DEVICE_GROUP_NAME "/"
// Safaricom APN
#define SAF_APN "iot.safaricom.com"
// Africa's Talking broker url
#define BROKER_ADDRESS "broker.africastalking.com"
// Africa's Talking broker port
#define BROKER_PORT 1883
- Reset the board the build
Setup Africa's Talking Account
USSD (Sandbox)
- In your Sandbox account, navigate to the USSD blade and click on "Create Channel"

- In the channel creation form, add an USSD shortcode number, and in the callback URL field add the your app URL and append
ussd. Example if your Heroku app url in 4 above ishttps://mycoolapp.herokuapp.com/then your USSD callback should behttps://mycoolapp.herokuapp.com/ussd.
- Save and in the end you should have something like shown on the screen grab below

IoT (Live)
- Inside your AT IoT account, Click on the
...under theActionstab for the device group you'd like to configure the callback for and update the callback URL toiot. Example if your Heroku app url above ishttps://mycoolapp.herokuapp.com/then your IoT callback should behttps://mycoolapp.herokuapp.com/iot.
The Simulator (Sandbox)
- Navigate to the AT Sandbox Simulator page. Enter a valid phone number.
- Click on the USSD option

- Dial your USSD code. If your short code above was 1000, enter
*384*1000#and press theCallbutton for magic!
TODO : Wiring
- Build your application and upload.