Charity project

Hello, I am a complete novice. I enquired on an electronics forum some months ago about a project I had in mind. I was recommended to look at an Arduino.
I bought one each for my grandson and I to learn on, and have some fun, which we are doing, but my progress is slow.

My project is to make a collection box for a charity event, which lets lights flash and a bell sound when money is put in the box.
I am not going to be proficient enough to do this on my own, so I am requesting help.

It is the 50th Anniversary of a local Hospice, St. Ann's Hospice in Heald Green, Cheshire, UK.

My wife and I are building a 3meter diameter (9.8feet) x 1m (3.2feet) high wooden framed 'Cake', which will be decorated with around 800 metal 'forget me not' flowers, purchased by donors in memory of loved ones cared for by the hospice, and so raising funds.

It is to be displayed in the Trafford Centre shopping mall, in Manchester, in June.

My idea is for the centre of the cake to have a single 10cm diameter ‘candle’ with seven LED bulbs at the top. A separate donation box will stand near the cake.

When the public place money inside the slot of the donation box it will cross an infrared beam, this will trigger a 'bell' sound at 262Hz and the first layer of lights to flash on at the same time. If a second coin is placed in quickly, then a higher pitch sound (330Hz) is heard and both the first and second-layer lights come on. If a third donation is given, again in fairly quick succession, the third tier of lights, along with the first two, and a higher-still pitch of sound (392Hz) come on. If a fourth donation is given, then all the lights flash four times with four pulses of the final highest pitch sound (523hz)

If the delay is too long between donations then it reverts to the first tier, as it does after the big final flash.

The idea is that children especially will be keen to keep adding coins to make the candle light up, helping boost the funds collected for the charity.

The charity 'box' is on a 3ft high plinth, and the electronics will be safely secured inside the back. It will be plugged into the mains electricity, and powered through a 'Dais' transformer, giving 12v to the system.

My big questions are whether the Arduino can firstly be programmed by my laptop, then to retain only the required information to stand alone and be powered by the transformer. Will the voltage have to be higher than 5 volts to reach the seven bulbs up to 3 meters (nearly 10 feet away) and if so I presume a relay will be needed?

I will send a sketch of what we plan, and my rough circuit idea.

My wife and I are both doing this without charge, and I am providing the equipment. The wood for the large cake structure has been donated by a local Hardware firm, as has the intumescent paint for all the wood, as it is on public display.

I am willing to pay for assistance, but my funds are limited, up to £100, but as it is for a charity perhaps someone could help for free?

Full credit will be given for your help.

I asked a couple of months ago for help, on another electronics forum, about possibilities for electronics for a Charity collection box idea. I was encouraged to look into Arduino. I bought an Arduino Uno start up kit for me, and one for my grandson, so we could have some fun, and learn together. We are having fun, but it is a steep learning curve for me, and I am not going to be proficient enough to get the initial job done in time. Is there anyone willing to help me with the project please? My idea is an infra-red detector inside the collection box, which triggers a light in a series, and a 'bell' sound, which increase if another donation follows quickly. I have the basic hardware, but knowing which transistors or capacitors to use is beyond my skills at the moment, and then there is the coding!

If you want to pay someone to design circuits and write code for you, there is a "gigs and colaberations" section of this forum. You could click "report to moderator" and ask for this topic to be moved there.

But as this is a charity project, I guess you will not be able or willing to pay, or pay enough, for that.

Otherwise, the forum will help you, but you still need to put in most of the effort and be willing to learn. If you explain more about the charity, forum members may be willing to go further than normal with their help.

You can google and learn the hardware bits

“ transistor As a switch “ “ Arduino IR” sensor and so on .

This really should be a simple project that you and your grandson can finish.

If you run into a problem area ask the volunteers here for help in either electronics construction or software.

BTW

Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.
Posting images:
https://forum.arduino.cc/index.php?topic=519037.0

Use CTRL T to format your code.
Attach your ‘complete’ sketch between code tags
[code]Paste your sketch here[/code]

Have fun.

I remember that post, under a different name. Did you follow the advice given, Have you done of the tutorials on basic electronics? The arduino Tutorials, the reading material? Most importantly did you design the project before purchasing hardware or did you purchasing the hardware first assuming it would do what you want? larryd, hammy and PaulRB have given you good advice.

To keep things together I have merged your original post and this one

The code is pretty simple - I can write it for you on the condition that if we happen to meet one day you will buy me a beer :wink:

The LEDs and sounds may well need more power than the Arduino can provide. Mosfets will do for the LEDs I expect. Your testing will prove that out.

The thing that would concern me most is how theft proof the cash and the Arduino hardware will be.

Thank you, for some reason I had missed those replies. Thank you to all who replied.

I am grateful, and accept your kind offer of help Wildbill, and I hope I will be able to buy you a beer!

The code will be pretty simple. Mating it up with the hardware and getting it all working will be harder. It will almost certainly take multiple iterations.

Below is the code I put together yesterday. It doesn't do exactly what you're looking for but it will give you something to test with. The pins I chose are arbitrary and easily changed.

It detects an input going low and interprets that as a coin being entered. That increases the level of enthusiasm the cake will display. If another coin arrives in time, enthusiasm increases. If not, it falls back a step. I note that it should actually fall back to zero - I'll fix that later. I didn't implement the level four special effects yet either.

I suspect that you will find that June is very much closer than you think once the build begins.

const byte LedPins[]={2,3,4,5,6,7,8,9};

const byte NumLeds = sizeof LedPins / sizeof LedPins[0]; 
const byte LedPatterns[4][NumLeds] = { 
                                       {LOW, LOW, LOW, LOW, LOW, LOW, LOW},
                                       {HIGH,HIGH,HIGH,LOW, LOW, LOW, LOW},
                                       {HIGH,HIGH,HIGH,HIGH,HIGH,LOW, LOW},
                                       {HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,HIGH}
                                     };

const byte SoundPin = 10;
const byte CoinDetectPin = 11;
const byte MaxExcitementLevel=3;

byte ExcitementLevel=0; 

unsigned long LevelChangeTime;
unsigned long ExitementInterval=5000;  // Milliseconds
unsigned long PatternChangeTime;
unsigned long PatternChangeInterval=1500;

bool PatternOn=false;

void setup() 
{
Serial.begin(115200);
Serial.println("Start");
for(byte i=0;i<NumLeds;i++)
  { 
  pinMode(LedPins[i],OUTPUT);
  }
pinMode(SoundPin,OUTPUT);
pinMode(CoinDetectPin,INPUT_PULLUP);
}

void loop() 
{
if(digitalRead(CoinDetectPin)==LOW)
  {
  HandleNewCoin();  
  }
if(millis()-LevelChangeTime > ExitementInterval)
  {
  if(ExcitementLevel>0)  
    {
    ExcitementLevel--;
    LevelChangeTime = millis();    
    }
  }
HandleSounds();
HandleLedPatterns();
}

void   HandleNewCoin()
{

if(millis()-LevelChangeTime < ExitementInterval)
  {
   Serial.println("coin");
   delay(250);
  if(ExcitementLevel< MaxExcitementLevel)  
    ExcitementLevel++;  
  }
LevelChangeTime = millis();
}

void HandleSounds()
{
switch(ExcitementLevel)
  {
  case 0:
    noTone(SoundPin);  
    break;  
  case 1:
    tone(SoundPin,262);  
    break;  
  case 2:
    tone(SoundPin,300);  
    break;  
  case 3:
    tone(SoundPin,392);  
    break;  
  }
}

void HandleLedPatterns()
{
if(millis()-PatternChangeTime > PatternChangeInterval)
  {
  Serial.print("Excite: ");
  Serial.println(ExcitementLevel);
  PatternOn = !PatternOn;
  if(PatternOn)
    {
    for(byte i=0;i<NumLeds;i++)
       digitalWrite(LedPins[i],LedPatterns[ExcitementLevel][i]);
    }
  else
    {
    for(byte i=0;i<NumLeds;i++)
       digitalWrite(LedPins[i],LOW);
    }
  PatternChangeTime=millis();  
  }
}

Wow, that is a brilliant start, thank you.

Here's a version that uses four LED pins. It has the level four pattern too.

// Cake Controller V002

// Changes
// Now another level of excitement and a new pattern
// Tones for levels moved to an array
// One Led pin per pattern

const byte LedPins[]={2,3,4,5};            // Arbitrary Led pins in an array so I can loop through them

const byte NumLeds = sizeof LedPins / sizeof LedPins[0]; 
const byte LedPatterns[5][NumLeds] = { // Patterns for the various led effects, including the special case of all off
                                       {LOW, LOW, LOW, LOW},
                                       {HIGH,LOW, LOW, LOW},
                                       {LOW ,HIGH,LOW ,LOW},
                                       {LOW ,LOW ,HIGH,LOW},
                                       {HIGH,HIGH,HIGH,HIGH}
                                     };

const int Tones[]={0,262,300,392,523};     // Tones for different exitement levels

const byte SoundPin = 10;                  // Used with Tone function to make noise with as yet unknown hardware
const byte CoinDetectPin = 11;             // The coin detector - active LOW
const byte MaxExcitementLevel=4;           

byte ExcitementLevel=0; 

unsigned long LevelChangeTime;
unsigned long ExitementInterval=5000;      // Milliseconds. How long do users have to add an extra coin
unsigned long PatternChangeTime;           // When did the pattern last change - used for flashing effect
unsigned long PatternChangeInterval=1500;  // Milliseconds

bool PatternOn=false;                      // Flash controller

void setup() 
{
Serial.begin(115200);
Serial.println("Start");
for(byte i=0;i<NumLeds;i++)
  { 
  pinMode(LedPins[i],OUTPUT);
  }
pinMode(SoundPin,OUTPUT);
pinMode(CoinDetectPin,INPUT_PULLUP);
}

void loop() 
{
if(digitalRead(CoinDetectPin)==LOW)
  {
  HandleNewCoin();  
  }
if(millis()-LevelChangeTime > ExitementInterval)
  {
  if(ExcitementLevel>0)  
    {
    ExcitementLevel--;
    LevelChangeTime = millis();    
    }
  }
HandleSounds();
HandleLedPatterns();
}

void   HandleNewCoin()
{

if(millis()-LevelChangeTime < ExitementInterval)
  {
   Serial.println("coin");
   delay(250);                 // Ugly delay to stop cointing coins more than one
  if(ExcitementLevel< MaxExcitementLevel)  
    ExcitementLevel++;  
  }
LevelChangeTime = millis();
}

void HandleSounds()
{
if(ExcitementLevel == 0)
  {
  noTone(SoundPin);  
  }
else
  {
  tone(SoundPin,Tones[ExcitementLevel]);  
  }
}

void HandleLedPatterns()
{
if(millis()-PatternChangeTime > PatternChangeInterval)
  {
  Serial.print("Excite: ");
  Serial.println(ExcitementLevel);
  PatternOn = !PatternOn;
  if(PatternOn)
    {
    for(byte i=0;i<NumLeds;i++)
       digitalWrite(LedPins[i],LedPatterns[ExcitementLevel][i]);
    }
  else
    {
    for(byte i=0;i<NumLeds;i++)
       digitalWrite(LedPins[i],LOW);
    }
  PatternChangeTime=millis();  
  }
}

Wow! that is amazing! It would take me all year to work out.

That should give you something to test. I suggest hooking up the LEDs and a switch to represent the coin detector to start with.

Thank you again! I am going to owe you a crate of beer, it would take me a year to work half of this out.

I have saved it to my arduino file, I am still working on the hardware. I will let you know what happens.

Hello again Wildbill,
I am sorry I have not been in touch, my wife and I have been full on creating the cake, which is now ready for the candle.


I have been advised to use a relay for the bulbs, so does the code need re-tweeking to allow this? No bulbs come on, on my mock up.

I assume it's one relay for each bulb?

The code may need changing, depending on the relays - many relay modules are active low and if so, all the lights are probably on at startup. Changing it would be simple though.

How is it all wired together?



It is just a mock-up, I will not have bare wires on the real thing!

The sound comes on with each trip of the infra red, and the LED diodes on the relay board start on, and switch off with each sound, so it knows something is happening, but the big bulbs don't come on.