Electronics board for Arduino soda machine monitoring...

Greetings fellow Hive members.

While stocking the soda machine at the hive over the weekend, I dug
into the electronics a little more to see what it would take to
complete the arduino soda machine monitoring project:

http://wiki.hive13.org/Arduino_Soda_Machine_Monitor

It looks like there are simple switches that we can monitor for when a
soda is purchased as well as when the "sold out" light is lit.

I am guessing we need to design a simple board that can detect when
these switches change state and report that to the arduino. It would
make sense to create two boards, each able to monitor 8 switches.
That way one board can detect when sodas are purchased and the other
can detect when a selection is sold out.

I need James (or anyone else) to confirm that this is the correct
approach and help with the design of such a board. I have already
done most of the arduino coding, although I do need to dig into xBee
and figure out how we can report the information to our web server.

Thanks!

--Ed

I think the basic idea is sound, but I really don’t think that two arduinos would be required. There are many other options for this, the easiest one being a decoder chip, such as the 74C922. Other options include using a PIC or different chip for additional inputs. While I like arduino for prototyping and certain tasks, I just think that if we need more capability than one arduino provides, we should examine additional options.

Isn't there an arduino with enough digital inputs for this? Like the
mega? I assume you want to use arduino so you can use the Xbee shield
and keep it simple, no?

The mega looks like it would work, but it seems like serious overkill to use something like that here, especially since it’s about 50-60 bucks. But, it would definitely work for everything that we would need it to do in this application, that’s for sure.

A mega would indeed have enough inputs, but it is a bit of overkill for just monitering a pop machine. I think a single arduino has enough inputs to do it by itself.

A regular arduino has 14 Digital I/O pins and 6 Analog I/O pins. The Analog pins can double as digital I/O pins. That gives us 20 digital I/O pins.

If we need to watch both the “Purchased” button and the “Sold Out” lights then that is 16 pins, leaving us with 4 more even if we just feed everything directly into the Arduino.

If we wanted to add an LCD, we have that LCD board that we can talk to over either i2c or serial. If we want the board to communicate to a computer over xbee (serial) then we are left with i2c which will take up 2 more pins (putting us at 18 used)

The serial connection will then take up the last two pins.

So in summary:

  • 8 Pins from the buttons to detect a purchase

  • 8 Pins from the “Sold Out” led’s to detect if it is sold out.

  • 2 pins for i2c to an LCD

  • 2 Pins used for serial (Tx, Rx)
    However, do we want to monitor both the “Purchase” button and the “Sold Out”? Just monitoring the “Purchase” will not tell us how many cans are left unless we keep count of how many we put in, which would in turn let us know when we are “Sold Out” without monitoring that switch, unless the Sold Out switch is merely a fail-safe in case someone miscounted or forgot to update the totals.

  • Paul.

i think we should also take into consideration that the arduino mega is mega.

i mean, who doesn't like mega?

I wasn’t going to use two arduinos - just one Arduino Pro, which is a Duemilanove without the USB connector so it’s under $20. I just didn’t know if it could read changes in the switches directly, or if James would have to create some PIC based board to handle that and report the results back to the arduino.

The reason I wanted to use the arduino is exactly what many have already stated:

  1. Easy I2C interface to a LCD display for feedback & user input.
  2. XBee component to handle communications to the web.
  3. Something that I can easily program. :slight_smile:

We could just monitor when sodas are purchased, as Paul stated, but as you mentioned, monitoring the “sold out” light is makes a fail-safe solution since the number of sodas a selection can hold (or how many are loaded) can vary. The LCD would allow the operator to enter the quantity loaded but I figured it wouldn’t hurt to have some redundancy. Overkill, probably, but if the hardware can handle it I see no reason why we shouldn’t include it.

Continue with your suggestions - this is the part that I don’t have the EE background in to design. I am just a programmer and missed James’ follow-up classes because of the holidays…

Thanks!

–Ed

Just a quick comment -

I think James’ idea to use a decoder chip is a great one - especially if a secondary board will be needed to monitor the switches anyway.

For those not familiar with decoders, an 8-to-3 decoder has 8 inputs (0-7) and 3 outputs. When one of the inputs goes into the active state, a 3-bit address is output. IE “010” would be input 2 and “111” would be input 7. The only caveat is that only one input can be active at one time for this to work properly (without scan circuitry), so it may only be usable for the “Purchased” signals. Even then, it still removes 5 needed inputs on the Arduino, bringing the total inputs down to 11.

TP