FYI: How to setup Crius AIOP Buzzer on A0-A7

Post Reply
riskable
Posts: 6
Joined: Mon Jan 06, 2014 3:52 am

FYI: How to setup Crius AIOP Buzzer on A0-A7

Post by riskable »

This post is mostly for folks googling how to do this...

I soldered a buzzer to my custom I/O board so that it was hard-wired to A7. It took me a while to figure out how to get it working since the information in config.h is non-intuitive (no, you don't need pilot lamp enabled to use the buzzer). Here's what you need:

Code: Select all

#define BUZZER
#define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A7, OUTPUT); // use A7 instead of d8
#define OVERRIDE_BUZZERPIN_ON               PORTF |= 1<<7;
#define OVERRIDE_BUZZERPIN_OFF              PORTF &= ~(1<<7);


The trick is that on ATMega2560 boards (like the Crius All-In-One-Pro) the analog pins (A0-A7) are actually PORTF, not PORTB. Also, the number next to your PORTF #define lines need to match the port number. So A7 needs to use '1<<7', A5 would be '1<<5' and so on.

Also, for those googling "what buzzer should I use?" I used, 5V Continuous Sound Piezo Buzzers that have the little, "remove seal after washing" sticker. They weigh ~1.6g each and are really quite loud.

No, I did not use a resistor when wiring them up directly to A7. If I burn it out, well, I only paid ~$3 for five of them (shipped).

EDIT 2014-01-26: I just realized the eBay link I used only works for me so I've replaced it with an Amazon link to what appears to be the exact same product (at pretty much the same price).

Jimbo385
Posts: 55
Joined: Sun Apr 21, 2013 8:00 am

FYI: How to setup Crius AIOP Buzzer on A0-A7

Post by Jimbo385 »

Can I use the buzzer that comes with the KK2.0 board?

Thanks

Jimbo385
Posts: 55
Joined: Sun Apr 21, 2013 8:00 am

Re: FYI: How to setup Crius AIOP Buzzer on A0-A7

Post by Jimbo385 »

I must admit that I am getting more and more confused the deeper I get!

Another board is saying plug the +ve into pin 32 and you are saying A7!

Which do I choose and what apart from code is the difference?

Also, If I go for your solution, where do I or more to the point, where do you plug the -ve from the buzzer?

Cheers.

Jimbo385
Posts: 55
Joined: Sun Apr 21, 2013 8:00 am

FYI: How to setup Crius AIOP Buzzer on A0-A7

Post by Jimbo385 »

The answer to my question is yes as I've now done it. Mine was setup on pin A6 not A7 so I just changed PortF to A6 not A7.

Job done!

o_lampe
Posts: 117
Joined: Sat Nov 02, 2013 5:09 pm

Re: FYI: How to setup Crius AIOP Buzzer on A0-A7

Post by o_lampe »

I have the same Crius AIOP board, why can't we use D8, like it is usual?
I tried to connect the buzzer to motorpin 8 and GND, but no beeps so far. Is it the wrong pin?

THX
Olaf

Jimbo385
Posts: 55
Joined: Sun Apr 21, 2013 8:00 am

Re: FYI: How to setup Crius AIOP Buzzer on A0-A7

Post by Jimbo385 »

Olaf,

Yes it's the wrong pin. My understanding is that it will only work with the analogue ports A0-A7. The code then needs to be changed to make it work.

Post Reply