# Ardbir build help please.



## aamcle (23/12/15)

I have a PCB for this project made from the drawings and I'll build it up over the next couple of months.

There a number of things I like to ask about,

What's the best way to mount it all in a enclosure/box? 
Are there any pictures?

The small display, do I just cut a matching hole in the enclosure and push the LCD into it?

There seem to be two possible sets of buttons a matrix membrane and real buttons.

How would I mount the matrix membrane so I could press its keys?
Or 
If I use real buttons how do I connect them to the arduino? 

Many thanks. Aamcle


----------



## dblunn (26/12/15)

Hi, I am not familiar with the unit you have but I have built a Matho's one. I'll try and help.


aamcle said:


> I have a PCB for this project made from the drawings and I'll build it up over the next couple of months.
> 
> There a number of things I like to ask about,
> 
> ...


----------



## aamcle (27/12/15)

Many thanks, I appreciate your help 

Aamcle


----------



## mr_wibble (4/1/16)

Buttons can be connected to an arduino quite easily. You basically run 5V/VCC to one side of the button, then out the other side of the button through a 10k resistor to GrouND. Then take a signal wire from the junction of the resistor and the button to an Arduino digital in. Of course there's plenty of alternative ways to do this, but this one is simple.




It's then easy to read the button state with a digitalRead() ~

const int BUTTON_PIN = 4;

void setup()
{
pinMode(BUTTON_PIN, INPUT);
}

void loop()
{
if (digitalRead(BUTTON_PIN) == HIGH)
 { 
 delay(50);
 if (digitalRead(BUTTON_PIN) == HIGH)
 {
 // * do something *
 Serial.print("Button pushed");
 }
 }
}

You read the button state twice because you get "bouncing" in the signal as the button finally comes to rest in contact with the switch terminals. (There's other electrical ways to solve this too)


----------



## dblunn (4/1/16)

You can also use 

void setup()
{
 pinMode(BUTTON_PIN, INPUT_PULLUP);
}

and just use the switch to pull the input pin to ground and get rid of the resistor. Saves a bit of wiring but now the pressed button is LOW i.e.

void loop()
{
if (digitalRead(BUTTON_PIN) == 0)
 {
 delay(50);
 if (digitalRead(BUTTON_PIN) == 0)
 {
 // * do something *
 Serial.print("Buttoned");
 }
 }
}


----------



## quantum8 (5/1/16)

aamcle said:


> I have a PCB for this project made from the drawings and I'll build it up over the next couple of months.
> 
> There a number of things I like to ask about,
> 
> ...


All depends on how you want to set it up really! Which version of the ardbir are you using? The one where the arduino is built onto the board, or using a separate UNO/Mega board?

I recently made one that sits on PCB spacers screwed onto a mounting plate inside the enclosure.

My LCD is mounted on top of the PCB to be easily seen from the top (I used a clear cover). You can easily cut a hole on your enclosure lid to mount the LCD using screws. Just make sure you use some silicone around the edges to help prevent any water/wort from spilling inside!

I used real buttons on mine. All you need is 5 wires; connect one pin of the button to the appropriate output on the PCB (up, down, start, enter). The ground wire can then be looped to the second pin on all the buttons.


----------



## Diode (5/1/16)

You could also be suffering from switch bounce

A small cap across the switch should help


----------



## quantum8 (6/1/16)

^ the ardbir boards already take this into account, so the OP won't have to worry about this.


----------

