Is it possible to use ultrasonic sensors maybe HC SR04 type as unlock sensors? I'm figuring out if it can replace matrix keypad?

For example 6 HC SR04 are used to be an input sensor waiting for a pattern to unlock a certain thing? Usually, in matrix keypad we will push [ 6,0,1,7] as the password is it possible to replace that with ultrasonic sensors as the receiver of input, and if it i possible, what type of code to be used?

  • I guess you can make it so that when anyone stands in front of it then it unlocks but that doesn’t make it very secure.
    – Delta_G
    May 6 '20 at 16:35

Short answer: yes.

General answer: you can use any input device for use as unlock mechanism. You can use a keypad, several single buttons, you can even use a single ultrasonic sensor (and depending on the distance differences from that sensor create a pattern), you can use a microphone, a temperature sensor (that will be tricky to unlock something though).

I would start with a typical example of an ultrasonic sensor sketch and program a pattern recognition algorithm in it. How that sketch would look like exactly, depends on your requirements (how you want to store the pattern, should it be hardcoded or changeable).

First try one sensor, than try multiple (I never tried, but I guess it's possible). If not by a default library, you have to write your own (that will be tricky possibly). Than think about the pattern recognition (values of the ultrasonic sensor in the correct order), than about changing/storing the 'code'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.