Blog

March 29, 2014 | Arduino , Robotics |

Ultrasonic sensor HC-SR04 with Dagu Mini Driver on a Robot Chassis

I am working on a Raspberry Pi based robot, and recently acquired a Dagu chassis and a Dagu Mini Driver for this project. As soon as I had the mini driver hooked up and the wheels starts turning, I felt an irresistible urge ;-) to put an ultrasonic sensor on the chassis and have it roam around by itself.

I've written about hooking up the inexpensive and fun Ultrasonic sensor HC-SR04 with an Arduino before. The wiring is the same - instead of a real Ardunio board, we're just using the Arduino compatible Dagu Mini driver here. You can see some details for this board at the link below. Unfortunately, they don't give you the full schematics.

http://www.dagurobot.com/goods.php?id=142

As far as construction goes, the Dagu chassis is very easy to put together. It can, and in fact it was put together by a 9 year old. :-)

Also as you can see, I've used very high tech Tie Wrap Technology to attach the sensor to the chassis. ;-)

The motors and the board are powered by a 3000 mAh 1A Anker rechargeable battery - good stuff!

The programming part is quite simple. The main loop sends out a ping on the ultrasonic sensor. If it returns a distance less than a set threshold the wheels are made to stop and reverse. Then, the chassis is made to turn left by a bit, and this process repeats. This is a very simplistic algorithm, but you can modify it for more sophisticated behavior.

You can see the robot in action in the video below.

Here is the full source code:

Not a complex project by a long shot. But it was a great fun detour for me, and I hope you find some useful information here.


Consulting

Need help with a hardware project or product? Drop us an email at info@electronut.in. We offer consulting services on AVR and Nordic nRF BLE - hardware design, firmware development, prototyping, PCB design/assembly, sourcing and manufacturing. We can help you bring your product to market!


Bluey nRF52 BLE IoT dev board

bluey
Check out our Bluey nRF52 BLE development board with built-in Accelerometer/Gyroscope, Temperature/Humidity and Ambient Light sensors. It's a fabulous tool to learn Nordic nRF52 BLE programming and explore IoT technologies.

Questions/Comments

We love hearing from our readers. Email us at info@electronut.in for questions or comments on this article. If you found this article useful, please support us by buying some of our hardware products.


Please sign up for updates

Once in a while, we will send you an email update on the latest Electronut Labs projects and products. Your email address will never be shared or abused, ever.

2016 Electronut Labs. All rights reserved.