Electronic Vote

Electronic Vote

Material Required

  • Printoo Core
  • Electrochromic Display Driver
  • 2x Ynvisible Electrochromic Displays
  • Coin Battery Holder
  • Conductive Ink Adapter
  • Conductive Paint
  • Bluetooth 4.0 Module (optional)
  • Smartphone (optional)

Schematic

Schematic: Electronic Vote

Code

Download from GitHub

  1. /**********************************************************************
  2. * © 2014 YD Ynvisible, S.A.
  3. *
  4. * FileName: Electronic_Vote.ino
  5. * Dependencies: CapacitiveSensor.h, YNDISPLAY.h
  6. * Processor: ATmega328
  7. * IDE: Arduino 1.0.5
  8. *
  9. * Description:
  10. * Vote counter based on capacitive touch and
  11. * Ynvisible Electrochromic Displays
  12. **********************************************************************/
  13.  
  14. #include <CapacitiveSensor.h>
  15. #include "YNDISPLAY.h" //insert Ynvisible library in the same folder
  16.  
  17. unsigned int i=0, j=0;
  18. const int num_displays=2;
  19. int data[num_displays];
  20. YNDISPLAY Display(num_displays); //initialize an instance of the class
  21.  
  22. CapacitiveSensor cs_4_5 = CapacitiveSensor(4,5); // 10M resistor between pins 4 & 5, pin 5 is sensor pin, add a wire and or foil if desired
  23. CapacitiveSensor cs_4_6 = CapacitiveSensor(4,6); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil if desired
  24.  
  25. void setup()
  26. {
  27.  cs_4_5.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an exampl
  28.  cs_4_6.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an exampl
  29.  Display.init(9,11,8,13,12); //initialize (int latchPinIN,int clockPinIN,int dataPinIN,int enPinIN,int en_regPinIN)
  30.  Display.update(0,'d',2,data);
  31.  Display.update(0,'i',1,data);
  32.  Display.refresh(data);
  33.  Display.clean(2000); //Initial update time - restart to Zero
  34. }
  35.  
  36.  
  37. void loop()
  38. {
  39.  long start = millis();
  40.  long total1 = cs_4_5.capacitiveSensor(100);
  41.  long total2 = cs_4_6.capacitiveSensor(100);
  42.  
  43.  if(total1>10){
  44.  j++;
  45.  //DISPLAYS REVERSE
  46.  Display.reverse(1000);
  47.  //DISPLAYS CLEAN
  48.  Display.clean(1000);
  49.  //UPDATE DATA=i;TYPE:DIGIT, DISPLAY 2
  50.  Display.update(j,'d',2,data);
  51.  //DISPLAYS REFRESH
  52.  Display.refresh(data);
  53.  if(j==10){
  54.  j=0;
  55.  }
  56.  }
  57.  if(total2>20){
  58.  i++;
  59.  //DISPLAYS REVERSE
  60.  Display.reverse(1000);
  61.  //DISPLAYS CLEAN7
  62.  Display.clean(1000);
  63.  //UPDATE DATA=i;TYPE: INVERTED DIGIT, DISPLAY 1
  64.  Display.update(i,'i',1,data);
  65.  //DISPLAYS REFRESH
  66.  Display.refresh(data);
  67.  if(i==10){
  68.  i=0;
  69.  }
  70.  }
  71. }
  72. //END
/**********************************************************************
* © 2014 YD Ynvisible, S.A.
*
* FileName: Electronic_Vote.ino
* Dependencies: CapacitiveSensor.h, YNDISPLAY.h
* Processor: ATmega328
* IDE: Arduino 1.0.5
*
* Description:
* Vote counter based on capacitive touch and 
* Ynvisible Electrochromic Displays
**********************************************************************/
#include <CapacitiveSensor.h>
#include "YNDISPLAY.h" //insert Ynvisible library in the same folder
unsigned int i=0, j=0;
const int num_displays=2;
int data[num_displays];
YNDISPLAY Display(num_displays); //initialize an instance of the class
CapacitiveSensor cs_4_5 = CapacitiveSensor(4,5); // 10M resistor between pins 4 & 5, pin 5 is sensor pin, add a wire and or foil if desired
CapacitiveSensor cs_4_6 = CapacitiveSensor(4,6); // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil if desired
void setup() 
{ 
 cs_4_5.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an exampl
 cs_4_6.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an exampl
 Display.init(9,11,8,13,12); //initialize (int latchPinIN,int clockPinIN,int dataPinIN,int enPinIN,int en_regPinIN) 
 Display.update(0,'d',2,data);
 Display.update(0,'i',1,data);
 Display.refresh(data); 
 Display.clean(2000); //Initial update time - restart to Zero
}
void loop() 
{
 long start = millis();
 long total1 = cs_4_5.capacitiveSensor(100);
 long total2 = cs_4_6.capacitiveSensor(100);
 if(total1>10){
 j++; 
 //DISPLAYS REVERSE
 Display.reverse(1000);
 //DISPLAYS CLEAN
 Display.clean(1000);
 //UPDATE DATA=i;TYPE:DIGIT, DISPLAY 2 
 Display.update(j,'d',2,data);
 //DISPLAYS REFRESH
 Display.refresh(data);
 if(j==10){
 j=0;
 } 
 }
 if(total2>20){
 i++;
 //DISPLAYS REVERSE
 Display.reverse(1000);
 //DISPLAYS CLEAN7
 Display.clean(1000);
 //UPDATE DATA=i;TYPE: INVERTED DIGIT, DISPLAY 1 
 Display.update(i,'i',1,data);
 //DISPLAYS REFRESH
 Display.refresh(data);
 if(i==10){
 i=0;
 }
 } 
}
//END

 

2 comments for “Electronic Vote

  1. Fernando Pinto
    April 26, 2014 at 18:55

    Hi,

    I have been following your project with interest, as a potential customer. Do you guys expect to have a system similar to the elctronic vote demo, but with more voting alternatives and information storing capabilities?

    Thanks for your time and good luck with your project!

  2. Paulo
    April 29, 2014 at 16:29

    Hi Fernando,

    Thank you for your interest.

    We are going to publish the code and schematics for the Electronic Vote demo (as well as for any other demo) here in a few days time. We hope that with these available anyone will be able to re-create and adapt the various demos accordingly to their needs. In fact, we want to stimulate others as much as we can to develop new ideas from ours projects. We will also try to provide the necessary support for this to happen, and help whenever we can.

Comments are closed.