
* Pass as a parameter the trigger and echo pin, respectively, * This example code is released into the MIT License. * created * by Erick Simões (github: | twitter: ) * modified * by Erick Simões (github: | twitter: ) * modified * by Erick Simões (github: | twitter: ) * * Example: ultrasonic.distanceRead (INC ) * * By default, the distance returned by the distanceRead () * method is in centimeters, to get the distance in inches, * Note: You need not obligatorily use the pins defined above

* | HC-SC04 | Arduino | | 3 pins | Arduino | *. * three pins ), attached to digital pins as follows: * * Module HR-SC04 (four pins ) or PING ))) (and other with * sensors (liek HC-SC04 ) and three pins (like PING ))) * and Seeed Studio sesores ). They are supported to four pins ultrasound * Prints the distance read by an ultrasonic sensor in In case the bin is full, an SMS alert is sent out using the Twillio SMS service.

The Python script then checks if the distance is less than a preset threshold (basically if the last banana peel is too high in the trash pile).
#REAL SMART TRASH YALK SERIAL#
The Arduino Code linked in below measures the distance using the Ultrasonic sensor and thereafter sends it to the Bolt Wi-Fi module over serial communication.Ī Python Script (running on a server or your PC, for instance) queries the Bolt Cloud for this distance value using the Bolt Python Library, which in turn is based on the Bolt open APIs for Serial Read. However, Erick Simoes' Ultrasonic library (available from the Arduino Library Manager) greatly simplifies things by abstracting away the core implementation.Ĭheck it out on GitHub to see the basic Hardware connections as well as an explanation of the basic structure and usage of the library. Usually, interfacing the Ultrasonic sensor is kind of non-trivial, in that one needs to use it in the manner of the functioning as explained in the blog by Dejan linked in above.
