The code waits for a rising edge on the echo pin, then switches to the envelope detector output and waits for it to fall below the trigger level, finally calculating the time between the two events. The multiplexer switches between two signals first the echo pin on the HC-SR04 (analogue pin 0), I assume the rising edge of this is honest second the output of the envelope detector circuit (analogue pin 1). One input to the analogue comparator (AIN0, digital pin 6) comes from a potentiometer which is used to set the trigger level the other input comes from the ATMega analogue multiplexer. The capture register is used for all timings. Hence the target for the envelope detector output is the ATMega 328p analogue comparator. Making use of the analogue voltages that can be extracted from the HC-SR04 my aim was to use the ATMega 328p, rather than attempting to re-inject data into the HC-SR04 or build more electronics. Photos 4 and 5 show the HY-SRF05, a similar module. claims the MAX232 is not powered on long enough to do anything (see the " postscript"). In it is described how a MAX232 chip is used to drive the transmitter transducer the idea is that it generates voltages outside the power supply range. Photo 3 shows an example of another "HC-SR04", this one does have an LM324 but is quite a bit different for one thing the two transistors are missing. This change is claimed to allow operation down to 3.3 V supply and lowers the current requirement (see below). The chip on the left is a SGM324YS14 quad op-amp, not the LM324 in some versions. Photos 1 and 2 show the HC-SR04 module I used.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |