Page 1 of 1

Convert from Mega to Controllino Mega - KeyPad problem

Posted: Thu Nov 28, 2019 3:30 pm
by miko-edv
first Controllino project and directly first question ...

After having built on a "normal" Mega a larger project, including several "home-built" extension boards for special functions (mainly voltage adaptions on input and output), we found the Controllino hardware. Now we want to switch due to the built-in features that will make at least 2 of our own boards obsolete.

1st step: take the source, include Controllino.h, compile - and smile, all code is accepted. So far, so good.
2nd step: attach the "simple hardware" - Ethernet-Cable, LCD-4*20, Keypad-4*4 ...
-- Ethernet - check
-- LCD - check
-- KeyPad - no ... and here's the question:
originally the KeyPad is connected to pins A8..A15, here on the Controllino I changed in the software the ports to Controllino_A8..A15, connected the wires to pins X2/5..10 and X3/3..4 and would assume that it will continue working. But - no matter what key I press, the program does not show any reaction. Even switched the keypad against 2 spare parts, but no ...

So - what did I wrong?

Thanks in advance

Re: Convert from Mega to controllino Mega

Posted: Thu Nov 28, 2019 3:52 pm
by miko-edv
add-on: maybe this can help for analysis

since it's getting a bit darker out here and I had not yet the lights switched on, I just saw by fortune that the A8..A11 LEDs come alight _very_ dimly, when I press keys on the KeyPad.

Re: Convert from Mega to controllino Mega

Posted: Thu Nov 28, 2019 4:02 pm
by miko-edv
next add-on:

some debug printlns later, I see that there is a rogue "key 1 pressed" on start of loop (), but only once.
That guides me into "are the ports/pins the correct ones?"

Re: Convert from Mega to Controllino Mega - KeyPad problem

Posted: Fri Nov 29, 2019 7:33 am
by miko-edv
another add-on:

the same behaviour ist on execution of the KeyPad sample sketch ... so I dare to say it is not the software causing the problem ...

Re: Convert from Mega to Controllino Mega - KeyPad problem

Posted: Tue Dec 10, 2019 12:33 pm
by miko-edv
next steps are done:

1st - changed the connectors from the above mentioned "Ax" into Dx" (X1/12..17, X2/12..13) and everything works well.

2nd - so far so good - but why use so many ports? try i2c also for keypad, as we already do have a 20*4 LCD on the bus. Buy pcf8574, connect and check with small test sketches. Everything works fine!

3rd - get into the "real" sketch and ... the above mentioned "rogue 1" returns! and the i2c bus freezes, at least regarding the keypad. the LCD is furtheron useable by functions executed from other input sources, especially via ethernet.
It's not from the other included libraries (ethernet, controllino, accelstepper, spi, eeprom). These I can also include into the working test sketches.

in some other forums i found the bus wiring length as reason mentioned, which might be preventioned by pull-up resistors. but that i first must discuss with my electronis guru before i grill the chips ...
btw: wiring might be much shorter if the different designers of the interface boardlets had not interchanged the sequence of vcc and gnd, then i just could piggyback them ... so i do need another length of strips in between them :(

Re: Convert from Mega to Controllino Mega - KeyPad problem

Posted: Mon Mar 09, 2020 12:27 pm
by Jarda
the problem of using A pins as input is, that inside the CONTROLLINO there are used pull-downs in this input to handle the 12V/24V input voltage on analog inputs at screw terminal. So you shall not use for example internal pull-ups, but try to connected the keayboard to the Dx pins where are not puldowns.
You shall be also carefull, that Dx pins on the pinheader are somehow in parallel to crew terminal outputs, so via via logic 1 on the screw terminal you are switching also the corresponding output. Here you shall double check the configuration of the processor that you are not going against for example log. LOW.
About the I2C there can be problem with too high pull-ups and higher capacitance connected on the bus. Please check via oscilloscope the slopes and tune it regarding the results.