Ultrasonic toggle switch

ultrasonic toggle

This is an idea for using an ultrasonic distance sensor (aka ‘pinger’) as a toggle switch. I’ll show it first and then explain:

As the hand approaches, the yellow light comes on to indicate that the switch is in aware mode.

When the hand is close enough, the green light toggles. That is, if it’s off, it goes on. If it’s on, it goes off. The yellow light, having done its duty, goes off.

The yellow light remains off while the hand is retracted to indicate that the aware mode doesn’t activate again until the hand is fully retracted. This is to prevent the ultrasonic equivalent of what is called ‘bounce’ in mechanical switches.

So what are the applications of such a switch? Suppose you have a runaway robot and you’re shouting at it but the background noise is high and so you take out your remote but there’s radio/IR interference too. You could chase after it and slam a mechanical switch on the back, but maybe that is getting too close for safety.

So here’s another solution: simply reach out toward the robot, and when you’re close enough (but still at a safe distance), the pinger detects your hand and deactivates the robot.

A more mundane application would be to turn fans and lights on and off more conveniently.

(In case you’re wondering, I had oatmeal for breakfast.)



Buy at Amazon:

Vivotech Hc-sr04 Arduino Ultrasonic Distance Measuring Sensor Module Good Compatible

Arduino Cookbook

About engineerzero

Once and future engineer.
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

2 Responses to Ultrasonic toggle switch

  1. Bharath says:

    Hi I really love your toggle switch because I wanted to make one but couldn’t code it to do so. I am currently making a cube timer using the ultrasonic sensor. Could you share the code to use the sensor as a toggle switch. Thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s