Noob question / project advice required - Voting system using buttons and electric imp and cloud


I need to design an electronic voting system for an event where we will present approx. 40 different products at an exhibition (two locations of twenty products in a row) and when a product gets a like, (i.e. the user presses a physical analogue / digital button behind the product they like) this press needs to be recorded and sent to the net into a database.

How would / should this be done in the best way? Do I need an imp for each button? Alternatively, could I run 20 buttons through a single imp and set that up twice?

Ideally, I need all presses collected, collated and aggregated into order for a leaderboard on the imp cloud. Is this possible? I will then pull this data down onto leaderboard using a digital display screen and a digital display device that will take the data and present it in the manner I require (already have that part sorted)

Happy to partner with and pay for someone’s time (i.e. an electronics engineer?) to get this running if they have done it before and can handhold me through my first imp project.

I want to identify the easiest and most cost effective way of doing this. I have looked at the electric imp and thought these would be ideal for the task, but as I have not used them before I want someone who has used them before and can offer additional options / designs. I need to identify not only the components required but also the best effective way to perform this task before purchasing any kit.

Look forward to hearing from you.

The imp requires wifi … do you have access to it at the event? And it can’t be a “captive” wifi, like an airport where you access it through a website (browser). You need to connect to the wifi router directly. Find out what is available at your event venue. Will they give you the wifi password?

With a portable router you should be able to get online through that.

The imp does not have enough pins for what you need, unless you start using voltage dividers, but that will mess up if multiple buttons are pressed at the same time. Instead you can use some io port extenders. (sorry, I don’t have a link, on my phone)

One example of an i/o expander, which has plenty of info / tutorials on the net would be the Microchip MCP23008. This is an 8-Bit I/O Expander with SPI/I2C Serial Interface. Another popular option would be the 16-bit version. There are others available on the market but you may not find much added info other than manufacturers data sheets. Use any of the main distributors Mouser, Digi, Farnell etc to search as there is plenty of choice available. If using I2C, you just use 2 pins on the IMP. According to Microchip datasheet for MCP23008 there are 3 hardware pins for setting the registers on the chip allowing for up to 8 devices to be used concurrently on the I2C serial bus… to read more about this i/o expander here is link to data sheet:

Getting a lot of addressable pushbuttons into a couple of pins is really hard to do.

I’ve never done that, but what if you bought a couple of midi keyboards and hacked the circuit board with a pushbutton for each key. Then, the midi output is read by the imp on one serial input pin.

Here’s 25 keys going to one midi port. But … their midi port is actually USB.

Here’s the way to convert that USB to 3.3V serial signals:

So the price list would be:
$50 for the Korg Nanokey
$10 for the USB converter
$30 for the Imp
$15 for the April Board
Pushbuttons with a plastic box for each? $50

So let’s say each 25 button station that is WiFi (Electric Imp) would be about $150

Then of course, someone has to build it and program it.

But, it’s a viable plan for reading lots of separate pushbuttons.

Woah, surely there’s easier ways than that. Here for instance is a $6 Adafruit module that connects via I2C and supports 39-key keyscan. (It’s mostly an LED driver, but you don’t have to use that bit, and it also includes keypad support: see its datasheet.) There is even imp reference code for its LED mode, though sadly not its keyscan mode.


Looks like Adafruit has it all!

Here is a handy breakout board, from Adafruit, which includes the MCP23008 as well as optional pull-ups. - it’s actually their LCD backpack but can also be used for IO. It includes 7 pins for IO and has screw terminals for power and I2C.

So ok this breakout option is certainly pricier than Peter’s suggestion for making a 3x7 matrix keypad / keyscan design, as you would need 2 or 3 of them (depending on how you do it), but the benefit of using MCP23008 is that there is plenty of info about how to use the chip and everything is done for you (well almost). Adafruit have libraries available (for Arduino) which you could adapt for Imp using Squirrel.

If you want to avoid I2C altogether then another suggestion is to use another MCU to handle the IO’s / button logic / debouncing etc. and then get the MCU to communicate with IMP via UART. ARM Cortex M0+ development boards are reasonable enough (e.g. Freescale FRDM… boards are good value and you can program these using the free online MBED compiler). You’re looking at approx $10 for a board.

Hi all, really appreciate your feedback and responses, thanks.

Update - I will have a router set up as hotspot for all the wifi devices and the router will be connected to net.

Ideally we wanted to have as little cabling as possible and need this to be as reliable as possible. by this I mean as near to 100% reliable as this is for a clients event.

The ideal solution / design would be for 40 independent modules that incorporate a button and an LED, that are battery powered, that when pressed would do two things (1) send a press signal to a cloud based database via my router (2) light the LED to confirm the press has been activated.

Behind the scenes was planning on sending the button presses to a drupal database but am unsure if I can do this or would have to use the imp cloud instead and still be able to access the data (aggregated into order) to pull down onto my display for the leaderboard.

NOTES- I am working to a tight budget but reliability is imperative over the costs

Are there any experienced freelancers out there that can do this for me / with me in order to be my imp pro for this project and the next couple too? I need to turn around a quote asap to get approval - this is passed 90% already, just need costs and timeframes.

Thanks (-;

With your most recent posting, this looks like a pretty simple project. The actual “module” circuitry would be easy: a pushbutton (you may select one that would be large and visually appealing–very subjective), a large LED, a couple of resistors, a transistor to handle switching the LED current, an imp001 card, an April breakout board and a 5 VDC power supply. Obviously, some form of case/enclosure may be required, again, depending upon how you want this to look. There would be 40 of these modules.

I would recommend pushing the data to GroveStreams and having a simple, stylish, auto-refreshing Dashboard that updates every few seconds to reflect the total number of counts per module. Using GroveStreams really simplifies the storage, aggregation and presentation and yet is very flexible. If you really do want the presentation via Drupal (due to an existing website), you could likely make a simple call from Drupal to the GroveStreams’ dashboard. I do this currently via Joomla! on our site.

Taking this approach would make it easy and flexible to re-use for future events with minimal prep work. Your choice of Electric Imp is spot on for this type of need.

I’m happy to offer some assistance if desired. You can PM me if interested in discussing further. Obviously, there are far more experienced users on this forum that may have better approaches.

I just recalled that I have a small PCB that was designed for a similar need that could be easily modified (simplified from its current 3 LED design) for a single LED.

I would agree with @hvacspei that if reuse, scalability, flexibility and reliability are more important than cost then 40 imp modules would probably be the way to go (or could have 1 imp handling 2 buttons etc). I think you wouldn’t require wiring as April can use batteries too. There is also the imp002 option for consideration (although never used this one, so cannot vouch).

If cost were more important and you did not want wires then you could create a localised RF sensor network and then use the imp via router as the gateway to the cloud. An example of one handy little off-the-shelf module which would work (in theory) is this one – uses batteries and already includes button and LED (or can connect better options via connectors) :

You would then connect an nRF24L01 to imp gateway… this has been done before and there are libraries available. Then as above use Grovestreams or equivalent (plenty options to choose from) to handle data capture.

Where is this project based anyhow as may be of interest.

Hi all, on a train -will be back in office tomorrow, thanks again for all the help and advice. I am in the UK. South East.

On a tight budget … and people are suggesting an imp and April board for each button?
That would be a great way to do it, but not on a tight budget.

If each of the 40 buttons was even $60 worth of imp, board, button, led, plastic box, lithium battery … getting everything at a discount someplace, you’re looking at $2400.

What exactly is your budget, or what is a “tight budget”?

What exactly is your budget, or what is a “tight budget”?
(-; how long is a piece of string? (-; It all depends on the client really: whether its a permanent or temporary deployment; the size of the organisation; the importance of the event / exhibition in their yearly cycle of public events & how many cool points they are going to get if we install something very unique or cool for them that is high profile & gets a high level of interest & recognition.

In all honesty, trying to get a client to tell me their budget is a science I have not yet mastered (if it’s at all possible) :smiley:
In my experience, it means they do not want to waste money and have a limited amount to spend, but if you give them real wow factor they are more prepared to find the extra for the right solution that’s as reliable as everything else we do.

I know this can be done with a few Raspberry pi’s, breakout boards, the switches etc. at a lower level of investment than 40 imps, however it’s the ability to have each unit standalone and not be running lots of cabling every time we deploy this option that is initially of interest to me, so quick and easy deployment is a primary aim; add to this the flexibility of the imp and the other ways it can be deployed with other sensors, buttons and the like then there is far more scope for reuse and options, which fits within the remit we have.

Someone should develop a circuit board for this, a robust box with a durable button. Then, each button box might have a unique code so they can be used anywhere mixed and matched. If it was a mass production thing, they all would be using the same code. Someone who needs them just orders a case of like 20 buttons, blinks them and sets them out waiting to be pressed. The company that makes and sells them would have a website with an API so people could access the button press data. I’ve seen nothing like this … has anyone else?

This sounds like (not an imp product).

I suspect you could likely build a version with an imp that comes in for less than €70 looks like a pretty nice solution when complemented with the appropriate cloud service for data aggregation and presentation–fairly easy, I believe!

That being said, it’s often interesting and beneficial to make something from scratch! I think you’d be hard pressed to come in much less than the above cost. The benefit from building a new device would be the ability to add hardware flexibility, perhaps a PIR sensor, additional indicators (lights, sounds, etc.)–I’m thinking modular inputs and outputs. Then again, creeping elegance usually hits the bottom line in an undesired fashion!

My first imp project involved three contraptions of: an imp001 with a PIR sensor and 3 LEDs, one for each house–our two daughters and our house. We each know when the others are home without requiring any action. The grandkids love it and it was fun writing one model that would handle all three sites. However, I do like the idea of smashing a button to, in effect, say, “Hello! I’m here!” or “I’m thinking of you!”. My next version will likely be a bit sexier with Neopixels and some additional functionality…and perhaps a button!