How to Write your own Flight Controller Software — Part 2

A Diversion down Hardware Lane

David Such
13 min readNov 26, 2020

Before proceeding with the flight controller software, we need to sort out a couple of hardware issues. These are, controlling a buzzer (i.e. a passive piezo) and understanding remote control inputs via SBUS.

Figure 1. 3–30V Passive Piezo.

The Buzzer Issue

Why can’t we just connect a piezo to a pin on our Nano and use PWM to create a tone? I’m glad you asked! The biggest problem is current limits on the I/O pins. If you have a look at the pinout information for the Nano 33 IoT, you will see that the maximum current per pin is 7mA. For the Nano 33 BLE, maximum output current is 15 mA, maximum input current is 5 mA and the maximum total current for the MCU and all GPIO’s is 25 mA.

We have selected the PS1440P02BT Piezo (Figure 1) as our noise maker. The data sheet doesn’t provide the current rating for the piezo, possibly because it varies with the voltage used. For 3.3V, the typical maximum current drawn for these devices is 9–14 mA, which is too much for our Nano. Thus we need to drive it via a transistor. Our buzzer driver circuit is shown in Figure 2.

--

--

David Such
David Such

Written by David Such

Reefwing Software · Embedded Systems Engineer · iOS & AI Development · Robotics · Drones · Arduino · Raspberry Pi · Flight Control

Responses (1)