Incremental counting problems

Hi there,

We’ve been handed some code to install on an Arduino pro mini to control some DMX 512 addressable theatre lights that have been retro-fitted with all new control gear + Arduino.

In this application there are three push buttons:

  1. Enter
  2. Down
  3. Up

These buttons are used to set the DMX address of the fixture by using the Up/Down pb’s. The Arduino interprets the digital inputs and then outputs to the LCD screen.

We are experiencing issues with the changing of the required values chosen by the Up/Down pb’s. Instead of reliably increasing/decreasing by one increment with each button push, randomly we find the value either returning to the starting value OR the value jumps around randomly (ie increments not equal to 1).

What confuses us is that we can use the pb’s to increase or decrease by one step which is correct, however the very next button press may change this value by x.

Once we have a DMX value set it is correctly displayed and operation of the fixture is perfect. The issue occurs when we change this DMX value.

We’ve attached all the code that is uploaded to the fixture and any advice or directions would be greatly appreciated. Thanks!

OSRAM55100A_LED_Display7.ino (3.55 KB)

display.ino (4.76 KB)

characters.ino (1.69 KB)

eeprom.ino (979 Bytes)

dmx.ino (686 Bytes)

It may be that the code you've received doesn't debounce the switches properly. You're using code that was designed for some other system, and the mechanical properties of your switches aren't the same. If that it the case, you might be able to debounce your switches using some hardware technique, so that the software you have becomes compatible.

One really failsafe debounce technique is to use the switch to trigger a one shot time interval with (say) a 555 timer chip, and let your code read the timer output, not the switch. Another good way is to use the switch to charge a capacitor through a diode (bleed resistor might be required), and read the voltage at the top of the capacitor as your input.

Hi,

Thanks for the advice, but this code was written for this system and there is a buttonDelay of 200 milliseconds on both the up and down pb's. What we are finding is that even if we hold the button it will increase with an increment of 1 until it suddenly and erratically jumps to another number or back to what the current DMX address is.

Are these buttons "takt switches".
They could be bad.

Can you wire another switch across to try.
Leo..

Hi,

Thanks for your advice, these are tactile switches, I have just paralleled another switch across the 'up' and the problem still exists when tested.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Just looking at the code ,the DIP switches have pull ups.
Do the UP, DOWN and ENTER buttons have pull up or pull down resistors?

Tom.... :slight_smile: