Mute by default?

Support forum for the mightyohm.com Geiger Counter.
http://mightyohm.com/geiger
Post Reply
MathPirate
Posts: 1
Joined: Mon Aug 12, 2013 7:35 pm

Mute by default?

Post by MathPirate »

Is there a way to mute the speaker by default, or maybe a quick hack to install an on/off switch for the beeper?
Right now, I have the Geiger counter running 24/7 (Using the USB power hack someone posted here a while back), attached to a Raspberry Pi, and constantly recording the background radiation level in my living room. Normally I have it muted so that the 20 or so beeps a minute all day every day don't drive me insane. Thing is, whenever there's a power outage, the speaker gets unmuted when the power comes back on. I'd like to be able to either flip the default, so that it's muted on power up and I have to press the button to get sound, or install some sort of on/off switch for the buzzer, rather than the momentary switch that loses state on a reset. I'm sure I could probably just short a wire across the speaker contacts or something like that to bypass the speaker, but I'd rather not permanently disable the speaker if that's possible. (Never know when I might want to show the system off to someone geeky enough to appreciate it!)
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Mute by default?

Post by mightyohm »

It would be easy to do this in firmware, if you have access to an AVR programmer and are interested in learning how to program AVR microcontrollers! But a much more simple fix might be to put a switch in series with the speaker.
JChristensen
Posts: 8
Joined: Fri Jan 17, 2014 3:51 am

Re: Mute by default?

Post by JChristensen »

Great minds think alike, I just did this:
https://github.com/JChristensen/geiger
Last edited by JChristensen on Fri Apr 18, 2014 12:22 pm, edited 4 times in total.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Mute by default?

Post by mightyohm »

Cool! Thanks for sharing your code - I like how you are using EEPROM to store the beep setting!
JChristensen
Posts: 8
Joined: Fri Jan 17, 2014 3:51 am

Re: Mute by default?

Post by JChristensen »

I really had to laugh, I had completed the change probably not 15 minutes before I saw this thread!

I have it running on an ATtiny4313. I wanted to have a backup MCU on hand, and checking prices at Mouser, ATtiny2313V-10PU was $2.73 and ATtiny4313-PU was $1.54. The '4313 is capable of low-voltage operation like the '2313V, but also has 20MHz ability plus twice the memory. Couldn't see a downside there :D

Feel free to use the code if you think it's a feature that folks will appreciate.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Mute by default?

Post by mightyohm »

Cool, thanks!

I haven't played with the 4313 yet but it sounds great!
JChristensen
Posts: 8
Joined: Fri Jan 17, 2014 3:51 am

Re: Mute by default?

Post by JChristensen »

mightyohm wrote:Cool! Thanks for sharing your code - I like how you are using EEPROM to store the beep setting!
Except I did it wrong. Just went to make the change to my second GC and realized that I'd left off the EEMEM attribute. The code above is fixed now. How embarrassing... :oops: (It worked without EEMEM but just due to dumb luck.)
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Mute by default?

Post by mightyohm »

Whoops! Thanks for posting the fix!
JChristensen
Posts: 8
Joined: Fri Jan 17, 2014 3:51 am

Re: Mute by default?

Post by JChristensen »

mightyohm wrote:Whoops! Thanks for posting the fix!
Guess it wasn't your turn to watch me. Someone has to keep me honest!

I made a couple more minor tweaks. I changed the name of the flag variable from nobeep to beep because constructs like if (!nobeep) make me crazy (remember I'm the guy that forgot EEMEM).

I also initialized the flag to 0xFF, so that programming the EEPROM on new factory chips is not required.

Finally, I posted the code to GitHub and replaced the code above with the link.
https://github.com/JChristensen/geiger
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Mute by default?

Post by mightyohm »

Cool! Thanks for sharing the link!
Post Reply