Scoreboard Project.

Hello.
I have just finished building my scoreboard using an arduino uno. It is controlled by 3 buttons up,down and reset. The button box controller is linked to the scoreboard with a 25 pin D printer cable 3 metres long. My problem I am having is. when I press the up button singularly to increase the score it will go up nicely and then randomly go back to zero. If I press and hold the button down it works fine. I connected the button box directly to the scoreboard so no cables are connected and it works fine. To me it looks like its the cable but do not understand how it works with the cable and the button pressed and held down. Any ideas what is wrong and what I can do.

How are the buttons wired to the Arduino? Are you using the internal pullups? Are the buttons debounced? How long is the cable?

The fact that the button works OK when directly attached and not with the cable could be cured by using a stronger pullup (or down) to overcome the extra electrical noise picked up by the cable.

Cross-talk, too weak pullups, no pullups.

Thanks for you replies. I am not familiar with this sort of procedure, but looking it up it looks like I have got to put a resistor in the button circuit. For fear of doing damage to my arduino can you possibly advice me on the size and where it should go?

If you wire the switch (button) one side to ground and the other to an input pin you can enable the internal pullup resistor and that's it. No external resistor required. To enable the internal pullup, in setup(), use the pinMode() function like so:

pinMode(pin, INPUT_PULLUP);

The button pin will read HIGH when not pushed and LOW when pushed, so adjust your logic accordingly.

I think this is already in the code. void setup()
{
Serial.begin(9600);
Serial.println("Cricket scoreboard controller Score");

pinMode(segmentClock, OUTPUT);
pinMode(segmentData, OUTPUT);
pinMode(segmentLatch, OUTPUT);
pinMode(upButton, INPUT_PULLUP);
pinMode(downButton, INPUT_PULLUP)

Why didn't you mention that earlier?

You could use external pullups, say 5k ohms, and change the pinMode so you're not using the internal ones.

Sorry I did't mention it before but until I read it in a earlier post I did not know about it. I am a novice in this.
On the arduino where do I fit it and what change do I make to the code?

Just add a pull-up resistor to the input pins: i.e. a resistor between the pin and 5V.

You'll have to debounce the buttons as well.

Pieter

Morning.
I have put a 4.7k resistor between the count up pin and the 5v pin on the arduino board. The result is with a 2 metre lead it works fine but when I connect a 3 metre lead it does the same randomly goes back to zero. Can I do anything to help this. Do I need to put a resistor between the 5v pin and the down count and reset pins.

Hi.
I have increased the resistor to a 1m and it all seems to be fine now. I hope. Thanks for your help it is well appreciated.

I have increased the resistor to a 1m and it all seems to be fine now.

You've decreased the pullup and cured the fault? (Assuming you meant 1M)

I may need to go back to school

We are going to need to change all of the school books, too.

Hi
I'm glade I can make some amusement for you. I am someone who wants to learn from a forum site. So replys telling me what I have done right or wrong would help me. Instead of comments that make me feel i'm having the pi-- took out of me.

groundsman:
Hi
I'm glade I can make some amusement for you. I am someone who wants to learn from a forum site. So replys telling me what I have done right or wrong would help me. Instead of comments that make me feel i'm having the pi-- took out of me.

A higher value of resistance has less effect - that might seem counter intuitive to you, but it is the case.

By changing the new pullup resistor from 4.7kΩ to 1MΩ you have made a weaker pullup.

It is your reporting that this has improved things when it should be hardly any different from the original case that is causing the amusement - you appear to be breaking the laws of physics.

My guess is that it is not the up button and associated circuitry that is the problem, but the reset button / circuitry. (After all, it is not counting up of it's own accord, but reseting.)

Try fitting the same 4.7k Ω value resistor to all three inputs.

I noticed in reply #5, you mentioned you had enabled the internal pullups on the up and down buttons , but did not mention the reset button. Was this an omission, as you only posted a snippet of your code,, or havent' you done it? If not, that might be the problem.

Thank you John for your comment. Yes the reset is the same as the up and down code.
I now understand what you are saying and will put a 4.7k resistor on both the down and reset pins. pinMode(segmentClock, OUTPUT);
pinMode(segmentData, OUTPUT);
pinMode(segmentLatch, OUTPUT);
pinMode(upButton, INPUT_PULLUP);
pinMode(downButton, INPUT_PULLUP);
pinMode(resetScore, INPUT_PULLUP);
It is odd why by putting the 1m ohm resistor in the count did not miss a beat.
I will report back after I have do this.

Hi.
I have now done what you said. At first I thought it had worked, but them it did it again. As you said it goes back to zero, so i disconnected the lead into the reset pin on the arduino and removed the resistor. the result was the same. I take it by removing the reset wire it should solve the problem.