coin piggy bank vid..
Moderators: adafruit_support_bill, adafruit

coin piggy bank vid..

by Ruffsta on Tue Nov 20, 2012 11:39 am

i was wondering what you would need to use a pref board instead of an arduino.. i don't want to keep buying arduinos for every project.. and well, i don't know what's needed to run the same bank without an arduino..

any help with this would be great!

also, how about a bill acceptor alng with the coin acceptor - that way you can insert either ;)
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by adafruit_support_bill on Tue Nov 20, 2012 1:29 pm

I use a lot of Boarduinos for embedded projects. They are cheaper and more compact than an Arduino - especially of you build them without the headers. http://www.adafruit.com/products/72
You can go even more basic if you want. If you search for "minimal Arduino" you will find lots of examples of how to build an Atmega328 system with very few components.
User avatar
adafruit_support_bill
 
Posts: 31061
Joined: Sat Feb 07, 2009 10:11 am

Re: coin piggy bank vid..

by Ruffsta on Tue Nov 20, 2012 6:14 pm

very interesting.. will have to add a battery back-up tho just incase power outage lol.. so, a battery back-up and save amount into memory.. but eeprom can only do 100,000 write/delete runs on the arduino.. so how do i keep the amount in memory because if it's going to write to the eeprom every time a coin is inserted.. the eeprom will be useless after awhile..
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by adafruit_support_bill on Tue Nov 20, 2012 9:29 pm

but eeprom can only do 100,000 write/delete runs on the arduino

Then again, 100,000 quarters will buy an awful lot of Atmega chips. :D
User avatar
adafruit_support_bill
 
Posts: 31061
Joined: Sat Feb 07, 2009 10:11 am

Re: coin piggy bank vid..

by Ruffsta on Wed Nov 21, 2012 8:27 am

lol, ok just for fun conversation..

so "IF" you were using just QUARTERS and your goal was $1,000,000

$0.25 x 100,000 = $25,000 - (400,000 quarters = 400,000 writes to the chips = 4 chips)

you would need 130 atmega chips (because each chip does only 100,000 writes).. now, if you are NOT using just quarters and using the multi-coin acceptor.. god only knows how many chips you would need.. i'm not even going to try to figure it out because there are so many possible combinations. lol

and in the end, they would all have to be replaced when starting the whole process again..
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by Ruffsta on Wed Nov 21, 2012 11:27 am

ok, someone on the arduino forum is mentioning something about "cells" - i have no idea what they are talking about since this is all new to me and my son..

can somebody please explain to me about chips and cells? is a digit a cell? i'm so lost.. yeah i'm a noob lol
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by adafruit_support_bill on Wed Nov 21, 2012 11:35 am

someone on the arduino forum is mentioning something about "cells"

What is the context? I'm guessing they are probably talking about batteries.
User avatar
adafruit_support_bill
 
Posts: 31061
Joined: Sat Feb 07, 2009 10:11 am

Re: coin piggy bank vid..

by Ruffsta on Wed Nov 21, 2012 12:22 pm

yes, 100,000 minimum

Of course, the 100,000 cycles applies to each cell. So, write 100,000 to each (collection of cells), then move to the next set. How many are in each set depends on the size of the value you are storing. You'd have one (set) to record where you were currently writing, updated only when that value changed.

reminimize eeprom uses: you don't have to write to eeprom everytime a coin is inserted. You can have the data held in ram and written to eeprom only when a brown-out is detected. You can use a diode / cap to isolate the mcu and outboard eeprom from the main rails to help sustain power supply for this purposes.

use lots of outboard eeprom and hash to distribute eeprom writes.
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by Ruffsta on Fri Nov 23, 2012 9:05 am

question..

according to the code for the piggy bank:
lcd.print(coins*.25);

but you are using the single coin acceptor in the video, what would be the code for the 4 coin acceptor?
lcd.print(coins*.01, .05, .10, .25); ??????
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by adafruit_support_rick on Fri Nov 23, 2012 11:17 am

What they're saying is that the 100,000-write limit applies to each byte of eeprom individually. If you were to treat the eeprom as a 1K circular buffer, you could do 100,000,000 writes before hitting the limit. "Cells" refers to the size of the data structure you write. If you write 4 bytes for each coin, then your eeprom would have 1K / 4 = 256 cells, and you could collect 256 * 100,000 coins.

Regardless of how you use the eeprom, the suggestion about only writing to eeprom when you detect a power failure is well worth considering. That's what most systems do.

adafruit_support_rick
 
Posts: 13086
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: coin piggy bank vid..

by Ruffsta on Fri Nov 23, 2012 11:57 am

ahhh... ok, thank you very much for that - much appreciated!

only writing to eeprom when you detect a power failure is well worth considering. That's what most systems do.


how do you detect a power failure in coding? because that sounds AWESOME! much better than the way i was looking at it..
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by adafruit_support_rick on Sun Nov 25, 2012 5:19 pm

Ruffsta wrote:how do you detect a power failure in coding?

Oh, my! Just look at this lovely can of worms! It's all rusty and dented… oh, and the lid is bulging, too! Shall we open it?

Generally, detecting power failures is pretty easy to do using the built-in brownout detect (BOD) feature of the atmel 328, but the arduino is set up so that you really can't do that. Briefly, the BOD will jump to interrupt vector 0 when it sees the power dropping, but the arduino is configured to always redirect that the boot loader reset address. That means you can't set up a brown-out interrupt service routine to write to your eeprom.

Well, you can, but it means reprogramming the fuse settings on the 328, and (possibly) disabling the arduino's automatic reset feature.

If you're planning to make a dedicated embedded gizmo using the Boarduino, for example, then you probably don't care about messing up any arduino settings. There are alternative bootloaders available - or maybe you don't use a bootloader at all.

So, the answer depends a lot on how comfortable you are with more advanced embedded programming techniques.

adafruit_support_rick
 
Posts: 13086
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: coin piggy bank vid..

by Ruffsta on Tue Nov 27, 2012 8:18 pm

which power supply was used in the vid?

also, would like to end up in a Boarduino in the end.. not the arduino.. wiring was not fully illustrated just for lcd..

would be nice to see the vid re-done with a boarduino :)
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am

Re: coin piggy bank vid..

by adafruit_support_bill on Wed Nov 28, 2012 7:42 am

This is the power supply: http://www.adafruit.com/products/352
5A is a bit of overkill for this application. A 12v 1A supply would probably be sufficient.
User avatar
adafruit_support_bill
 
Posts: 31061
Joined: Sat Feb 07, 2009 10:11 am

Re: coin piggy bank vid..

by Ruffsta on Wed Nov 28, 2012 8:17 am

thank you

so one of these would do:
http://www.ebay.com/itm/Supply-US-AC-100-240V-Converter-Adapter-DC-12V-1A-Power-/120960782555?pt=US_Server_Power_Supplies&hash=item1c29d310db

or must it contain that power box in the cord like the one you listed?
Ruffsta
 
Posts: 65
Joined: Tue Nov 20, 2012 11:35 am