Started 1st February 2016 - work in progress - correctness level low
The background to this page is my experience with the HC-SR04 ultrasonic ranging module using an ATMega 328p.
Having learnt to program the STM32F103C8T6 board with Arduino, I created some simple programs to use it with the HC-SR04. First with interrupts and then a timer capture register; the latter relies on the code from . Compared to the ATMega 328p interrupt results are more stable.
There is the problem of matching the 5 V world of the HC-SR04 to the 3.3 V of the STM32. I started by using the safe option of a couple of FET level shifters.
- Archive of Arduino sketchbook ping32int - using interrupts- (1st February 2016)
- Archive of Arduino sketchbook ping32capture - using timer capture - (1st February 2016)
However a sketch to use the HC-SR04 is included with the STM32 addition to the Arduino IDE, it can be found here:
or using the sketch menus to navigate to the same location.
- Maple frequency measurement - capture how to
- tone(), noTone() - timer device and channel from pin
- Bi-Directional MOSFET Voltage Level Converter 3.3V to 5V
- $10 O-Scope revisited - ADC code
- Spread Spectrum Phased Array Sonar