Showing results for 
Search instead for 
Did you mean: 

STM32 Keypad Interfacing Issue.

Associate III

Hi everyone,

I developed a custom board out of STM32F070CBT6 MCU. The board is supposed to handle a simple logic of a 5x4 matrix (similar to a 5x4 keypad).

The algorithm I've developed also involves the same logic used in a keypad that is,

  • The rows are inputs and columns are push-pull outputs
  • keep the rows pulled up
  • Send GND (Low Logic) over columns periodically
  • Scan the rows and light up an LED whenever the row reads GND.

The problem I'm facing is that this board works completely fine and the logic works perfectly over a test bench setup. However, I've to actually install this in a field where the input from 5x4 matrix comes from wires that are 1000ft away from my actual board. Now here, the board goes crazy and does not read the inputs properly.

Can anyone please help me out if it's an algorithm issue or a hardware issue?

Any help is highly appreciated. Thanks

Pavel A.
Evangelist III

> Can anyone please help me out if it's an algorithm issue or a hardware issue?

It's an issue of misunderstanding the requirements, which resulted in wrong implementation.

Or, if you prefer, issue of changed requirements, which leads to redesign.

-- pa

Hey there, thank you for the reply. I am more after, what could be the possible cause of error? Could you explain that if you understand the scenario?

300m of wire presents significant capacitance mutually between wires and at higher frequencies transmission lines effects.

So start with measuring/estimating at least the capacitances and connect such capacitances to your bench model.

There's also risk of induced noise, especially in industrial environment.

The normal way of how this is solved is that keyboard is decoded by a local mcu in one location, and information is conveyed through robust transmission (think RS485 through twisted pair, for example) to the mcu at remote location.


1000 ft is apparently too long. Inducted noise, voltage drop... and just too many wires to haul over 1000 ft.

-- pa

Associate III

@Community member​ That seems to be the case and I agree with you. Apparently, there's no other way except for a redesign to get the board working, Am I correct in assuming this?

If you're asking whether it is possible to make it work by only adapting the software - may be it is.

There's typically more than one way. But not all ways are equal.

-- pa

Yes, because a redesign at this point would cost too much time and money. If you can please suggest me some better ways, that'd be really helpful.

Unfortunately I cannot... Try to understand how exactly "the board goes crazy" - is it like a temporary noise/glitches? Can it be filtered by multiple reads? etc,

-- pa

@Pavel A.​ Alright, I'll try tweaking in the firmware, playing around with the delays or the logic and see if the response gets better. Thanks for the help man!