Skip to content

Android Things: HC-SR04 sonic distance sensor user driver with example

License

Notifications You must be signed in to change notification settings

holgi-s/RangeThings

Repository files navigation

Range-Things

RaspberryPI3 + Android Things with Nearby Connections, Bluetooth Low Energy and a HCSR04 Ultrasonic Distance Sensor

Pi3 + Sensor schematics:

Schematics

The app should query the sensor as fast to detect changes in the measured distance.

The idea was to place the PI and the sensor below a trampoline and count all jumps. There is a very simple "gliding lowest" filter. that will always take the shortest distance of the last 3 samples.

Here is the screenshot of the collected demo data.

Time series data:

TimeSeries

Zoom into demo data:

ZoomIn

Real life application:

Jump

The filter and jump detection is done on the RaspberryPI3. For debugging purpose I transmit not only the detected jump events, but also the raw range sensor data and the filtered range data to the phone.

The filter was necessary because when the system is performing system tasks, it will handle the i/o port interrupt too late and report a longer distance than actually detected. You can see these spikes in the raw sensor data.

About

Android Things: HC-SR04 sonic distance sensor user driver with example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages