I was not quite sure where to post this question but this seems like the most appropriate section to me. I have a quadcopter flight control board that uses an Atmega 32u4 processor which is uses open source software called Multiwii. There is a facility in Multiwii to use a switch on the transmitter to operate a buzzer connected to an output pin of the flight controller. I have set up the Multiwii GUI to allow this switch to show in the GUI and have a switch on the transmitter setting its assigned channel high and low dependant on switch position. Seeing as the processor is built into the PCB of the flight control board, the only pins that can be easily accessed are the ones that have been provided for boot loader programming, in the event of a corrupted boot loader. Seeing as both Miso and Mosi can be used as digital pins on the Atmega 32U4 I thought that I could connect a small buzzer between Miso and ground and operate the buzzer from the transmitter switch allocated in the GUI. I can see that the switch is working correctly in the GUI because it allows you to see this visually, the code has been modified by someone helping me in the Multiwii forum but it is not showing any switching action at the Miso and ground pins on the flight control board. I realise that this is not the ideal place to ask this question but I have run out of suggestions from the quadcopter guys and seeing as it is a question directly related to an Atmega IC I thought that someone here might be able to offer some assistance. I have posted a link to the initial question on the Multiwii forum and the code modifications implemented are shown there. I can provide a link to the full arduino files that are flashed onto the processor if required. Thanks and I hope that one of you here might be able and inclined to offer me some assistance with this as it seems to me that it is quite doable with the correct coding. And by the way the purpose of this buzzer is so that when, not if you lose one of these small aircraft, you can set the buzzer off as an aid to helping to find it. I cannot afford to lose any more of these, it's sending me broke The code additions were firstly
What is the exact model flight controller are you using? When you upload the MultiWii sketch, what Arduino board do you select? If it acts like a Leonardo you should be able to use Pin 14 (MISO/PB3), Pin 15 (SCK/PB1), and Pin 16 (MOSI/PB2) like any other digital I/O pins.
It is a narrow classic Alienwii John and you select Leonardo in the IDE. In the Multiwii software that this flight controller uses in conjunction with Arduino, you are able to assign a switch to a channel on the transmitter and have that set a pin on the Atmega32u4 high to sound a buzzer to locate a lost quadcopter. I have set that switch up in the Multiwii GUI and can see in the GUI that it is going high and low with switch movement. The only problem with the flight controller is that the only pins that are broken out are these six bootloader programming pins, hence the need to use one of them (I have chosen MISO) as a digital out for the buzzer. As it states in the thread I linked to above there is no switching action visible at the MISO pin just a fluctuating on/off voltage about every second or so. Someone on the AVR Freaks forum said "Normally if an internal peripheral is enabled it "takes over control of the associated pins", so you will need to turn off the SPI if enabled before you can access the pins for other uses. Check the datasheet, it should be a simple bit set/clear in one of the SPI registers" I am guessing that there is something in the code that is stopping MISO being set as an output pin. Did you see the code that the guy suggested I add
This flight controller uses the Atmega32u4 processor which is also the one used in the Leonardo. When you look at the pinout of the Atmega32u4 MISO is Digital pin 14 PB3
Pedro147:
This flight controller uses the Atmega32u4 processor which is also the one used in the Leonardo. When you look at the pinout of the Atmega32u4 MISO is Digital pin 14 PB3
I guess the pinout drawing is wrong as even IDE v1.0 has Leonardo pin 14 mapped to MISO.
If you have no joy with this you could maybe invest in one of these to alert you when the battery voltage drops enough (you may need to wait around for some time though)
Thanks for the Banggood link Riva. BG and my bank balance are well acquainted Actually it is going to be a buzzer that can be set off via a TX switch for when the tiny little quads get lost either up a tree, bushes or long grass usually
Pedro147:
Thanks for the Banggood link Riva. BG and my bank balance are well acquainted Actually it is going to be a buzzer that can be set off via a TX switch for when the tiny little quads get lost either up a tree, bushes or long grass usually
Yep, I realize that but if you get no joy with MISO then the linked component just plugs into battery and screams (very loudly) when the voltage levels drops to much. You would need to wait around till battery level dropped enough to set it off if you lost it though.
On a side note try one of these as you less likely to get lost.
Thanks Riva I see now Unfortunately min voltage for that is 7.4v (2S battery) whereas my micro quads only run 1S (4.2v) but It's a great idea if I move into bigger quads As for the "big" one, even with my eyesight I would be unlikely to lose that one. That is so good