Close

PIR and Sonar Sensors are in

A project log for Motion Controlled Cabinet Light

An LED strip of white LEDs that can be turned on, dimmed, and turned off with a wave of your hand

Thomas SnowThomas Snow 03/12/2015 at 14:470 Comments

I received the PIR and HC-SR04 sensors from China. The PIR sensors are working fine. The HC-SR04 sensors have a problem though. These are the 4 pin models (VCC, GND, Trigger, and Echo) which is different than the Radio Shack model I have been using, which is 3 pin. The 3 pin version multiplexes the trigger and echo. This isn't the problem because I planned for the 4 pin model. While these 4 pin Chinese models seem to provide a more stable reading (the 3 pin version seems to jitter a lot), if there is no return echo (i.e. you ping across a large space), they lock up. The 3 pin RS model will time out after about 40 ms. I read somewhere that this is because there is a faulty bit of code in these cheap Chinese versions. I don't know if they can be reprogrammed.

The only way to reset them is to power them down and back up again. I have the Reset pin of the ATTiny85 on the connector for the sensors (in the event I wanted to repurpose the boards) and I could program the chip to use it as an I/O line to bounce the sonar when it gets in this state, but once you program the chip to not use the reset pin, you can't easily reprogram it. There is some information that says you can use 12V on the reset pin to override this, but I will have to wait until I put together a programmer for it. So for now, I will be using the 3 pin model.

Discussions