Maker Pro
Maker Pro

Help with component choice / design in an alarm circuit

Kit Kaye

Jul 9, 2016
3
Joined
Jul 9, 2016
Messages
3
Hi Guys,

I'm designing a product at the moment and developing the circuitry with an arduino.
The basics of the concept is an alarm with a key pad deactivation..
A 4 number code is set, then the device recalls this code every time it is turned on
This code is required to be changeable, but it will not happen often.

Basically my issue is that i do not know what sort of micro chip will be needed to hold this information or if some kind of component array can be cheaply used to do the same job.

I'm not at all clued up on this stuff, but i'm trying hard!
It would be great to hear what you guys think is the best way to go about this.
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Hi Guys,

I'm designing a product at the moment and developing the circuitry with an arduino.
The basics of the concept is an alarm with a key pad deactivation..
A 4 number code is set, then the device recalls this code every time it is turned on
This code is required to be changeable, but it will not happen often.

Basically my issue is that i do not know what sort of micro chip will be needed to hold this information or if some kind of component array can be cheaply used to do the same job.

I'm not at all clued up on this stuff, but i'm trying hard!
It would be great to hear what you guys think is the best way to go about this.
How is the 4-digit number set?

You could honestly use any microcontroller for this...
If you share more details it would help more.
PIC for example excel at incredibly low power usage and I would recommend this if it were battery powered.
AVR is usually the core of Arduino anyway... but I dislike using 'Arduino Code' for any finished product because it's typically bloated and slower than if you had programmed an AVR directly.
 

Kit Kaye

Jul 9, 2016
3
Joined
Jul 9, 2016
Messages
3
The plan is for the user to set the code by pressing and holding a button on the pad until a led flashes, then input the original set code, then the led flashes twice and a new code is input.
Sadly arduino code is the only way i know how to do this.

It will only be the arduino chip in the final product, not an arduino board.

The 4 digits are set using a button keypad at the moment.
i plan to run it from a 6v battery

I suppose what i'm really after is; which micro controller to go for.. i have looked up the EEPROM types, but there are so many, i really do not know which to pick..
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I think pretty much all microcontrolles today use flash memory, not EEPROM, but that is unimportant since they pretty much do that same thing. Many have some flash data storage that you can write and will hold it's contents when powered off. This is where you would store the code. Others allow you to use part of the program memory for non-volatile storage. Just make sure the micro you choose has one or the other capability. I am a PIC guy, so I don't know the specifics of the AVR line of chips.

Bob
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
The plan is for the user to set the code by pressing and holding a button on the pad until a led flashes, then input the original set code, then the led flashes twice and a new code is input.
Sadly arduino code is the only way i know how to do this.

It will only be the arduino chip in the final product, not an arduino board.

The 4 digits are set using a button keypad at the moment.
i plan to run it from a 6v battery

I suppose what i'm really after is; which micro controller to go for.. i have looked up the EEPROM types, but there are so many, i really do not know which to pick..
Well... don't worry so much about type. If the microcontroller you have does not have built-in memory you can use for temporary non-volatile storage, you can buy something like this : https://www.adafruit.com/products/1564 (Discontinued... but you get the idea) to offload the storage to another component.
The 'external' component can simply be switched off by your microcontroller while it's not being read or written to in order to save power.
I think the most important factor for you will be low power consumption... Do you have an idea of how long you want it to last, and what kind of 6v battery you will use?

As mentioned previously, PIC is an *amazing* device when it comes to low power consumption... You'll often see components shown in current draw of a few mA or μA, but these things go even smaller at a nano-Amp scale!
A single LR2032 Coin Cell battery holds roughly 40mAh which could fully light a decent LED for a couple hours... when used carefully with a PIC, you could stretch the life to easily exceed the year mark.. (approx 7 years with a RTC enabled, watchdog, brownout detection with the device in 'sleep' mode)
AVR can go into a lower power state as well, which *is* used in an Arduino, so you may be able to stick with arduino if you can figure this out... please note though, that some of the extra components on an Arduino board waste energy... so if you are set on staying with Arduino code... look at 'Do it yourself' Arduino clones... and use an AVR directly with the minimal external components.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Relax, the arduino has "EEPROM" that you can use to store the correct code even if the power fails.
 

Kit Kaye

Jul 9, 2016
3
Joined
Jul 9, 2016
Messages
3
Thanks for the fast responses!
@Steve - I have been told that i can use the on board eeprom for prototyping, which i will do probably. but in practice i want to use a separate chip so i can cut the design down and so it can be turned off as suggested by GRYD3 saving power.

http://cpc.farnell.com/winbond-electronics/w25q80bv/w25q80bv-1mbyte-spi-flash-dip/dp/SC13848

I have found the above component, i know its expensive, but i can find a similar one and buy in bulk once i have proven the design.. Would this component do the job?

@Gryd3 - I am interested to know how these can be turned off.. is there a "power in" that can just be linked to a digital pin on the arduino and set to low V when not in use?
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The on board "EEPROM" retains it's contents when the chip is powered off. That is the what distinguishes it from the RAM on board. There is no need for an external chip, which would only make the hardware and software more complicated.

Bob
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Thanks for the fast responses!
@Steve - I have been told that i can use the on board eeprom for prototyping, which i will do probably. but in practice i want to use a separate chip so i can cut the design down and so it can be turned off as suggested by GRYD3 saving power.

http://cpc.farnell.com/winbond-electronics/w25q80bv/w25q80bv-1mbyte-spi-flash-dip/dp/SC13848

I have found the above component, i know its expensive, but i can find a similar one and buy in bulk once i have proven the design.. Would this component do the job?

@Gryd3 - I am interested to know how these can be turned off.. is there a "power in" that can just be linked to a digital pin on the arduino and set to low V when not in use?
It would be more practical to connect the power pin of this chip to a transistor that is controlled by the microcontroller. This way, you don't need to worry about the power draw of the chip, as the outputs from microcontrollers can be (and often are) pretty low. (less than 10mA - 20mA)
That said... this 'external' solution is *only* required if your microcontroller does not have on-board memory you can use, or if the on-board memory is too small. The majority of microcontrollers you see today have on-board memory though that will persist on power loss, and it does not waste any additional power by using this.
The on board "EEPROM" retains it's contents when the chip is powered off. That is the what distinguishes it from the RAM on board. There is no need for an external chip, which would only make the hardware and software more complicated.

Bob
If you are using 'Arduino' . look here : https://www.arduino.cc/en/Reference/EEPROMWrite
The AVR used has on-board memory, so you might as well use it. Less components, less power draw, easier to use.

I'm still unsure on the expected battery life, so I'm unsure if a low power PIC is essential... but because of your development cycle, it may be worth looking at using bare AVR chips and either using Arduino Code on them... or learning AVR code... At this point, you don't need an extra 'programmer' like you would with a PIC, because your current Arduino can double as a programmer, and bare AVR chips are only a dollar or two.
 
Top