Numeric Keypad..!!

I am back again with a strange question. Can I hook up the Robot with a numeric keypad, so I can assign tasks using numeric codes?!! OR the robot will never work unless I enter my security code.

It is just another question buzzing my mind. I didn’t look up for the solutions yet, but if I find the way I will post it up here. Anyway, I hope my questions give you more ideas to make robot programming more interesting.

Yes and no. You could hook a numeric pad up to the controller and have it read the digits and perform activities based on the number entered.

No, there is no way to attach a numeric pad to the existing transmitter.

So you would need to build a mechanical finger that you could “drive” that would press the right button causing the robot to do the activity you want. A little Rube Goldberg like, but would be very cool to watch.

Post pictures when you get it done!

You can hook up a numeric keypad into the Vex controller, but it would take some “hacking” - in the sense of Instructables/Make/Hack-A-Day. (As the number pad shown has 17 buttons - more than the Vex controller can handle).

One way to do it without using using a single digital I/O port for every key would be to use use some OR gates on a breadboard, and treat the keypad as a series of rows and columns. The simple way to do this would be to use nine digital I/O ports, however you can also use as few as five digital I/O ports* without using serial communications.

The simple way involves using OR gates for every row and column. Let’s assume that pushing the button returns true (1). OR gates will return a 1 if at least one of the input(s) was a 1; otherwise they will return a 0.

So say we push button “8”. The breadboard ORs together the first, third, and fourth columns (from the left), they will all return a logic 0 since nothing was pushed. But the second column will return a logic 1, since 0 OR 1 OR 0 OR 0 OR 0 will always return a one. We do the same thing for the rows, although separately.

Assuming these nine output lines are read in the code and stored as column_1, column_2, column_3, column_4, row_1 (top), row_2, row_3, row_4, and row_5, we can tell which button was pushed by checking which row and which column are both equal to 1.

So [FONT=“Courier New”]if (row_2 == 1 && column_2 == 1)[/FONT], then the only outcome can be that button “8” was pushed.

Once you figure out which key was pressed in the code, you can do all kinds of cool things, like look for patterns (secret passcodes, like up up down down left right left right B A. Wait, that’s not secret…) or perform different activities if a different key was pushed (we can all finally figure out what happens when someone enters 77…).

  • You can also build a breadboard that “encodes” each key as a binary piece of data, with each bit being sent as a separate digital input. Starting at the top left and working left then down (key 0 is “Num Lock”, key 1 is “/”, etc.), pressing key “8” would be key 5, which would be 00101. The period key would be key 16, which would be 10001.

You can also do this in even fewer input ports if you use serial communications on the Rx/Tx or Programming Port, but that starts getting really complex…

Nice Arthur you really nailed it. I will try your first method, it sounds much easier .

Another way to encode the keypad would be to string a bunch of resistors into a voltage divider with each key feeding a different voltage to an analog input.

The circuit is simple and only takes up one i/o port.


+5----/\/\---/\/\---/\/\---. . .---/\/\---GND
           |      |      |       |
           \      \       \       \      <-Key switches    
           |      |      |       |
analog in--------------------------

I haven’t tried it, but I suspect that you could use this method on the transmitter by wiring it into channel 5 or 6 in place of the pushbuttons on the back of the transmitter.

Thank you all. You guys nailed it for me.

artdutra04 : your first way seems earier, I will try it.

ltk: Is this Ladder Logic because I know nothing about it !!

I used four of the the VEX Controller’s PORTB weak pull-ups (interrupts 1-4) and four digital output pins to interface a 4 X 4 hex keypad to the VEX Controller, which allows me to enter the numbers “0” to “9”, “A”, “B”, “C”, “D”, “E”, “F”, “.”, and “#”.

I plan to integrate the keypad with my DIY LCD Display so that I can display a simple user interface on the VEX Controller.

Just hook up a numeric keypad to the vex D/O pins and write some code to read it.

Here is a nice keypad with all of the connections broken out, when a button is pushed it completes the circuit between two of the connections which could be read by a simple digital read.

Its cheap but it will consume a good deal of I/O pins using the matrix interface. (You might have to add pull up resistors but I think vex already has them built in)

This is much easier than using a breadboard with micro switches and cooler.

However I don’t really know just how secure it would be because if you program the code in verbatim then someone could download and read the code to get the password. I’m sure you could make something more secure but then again its a vex robot not a predator drone.

You could store the data in an EEPROM and “encrypt” it in a way that only the uC can “decrypt” it. But that would be major overkill, and besides, it would be quite difficult to find the code in a HEX file.

I just remembered that AVR micros have lockbits that prevent you from writing or reading the AVR once set. PICs probably have something similar.

Yes they do…

On the PIC’s, there are Configuration Options called FUSES.

One of the FUSES is the Code Protection (CP) option that prevents the Machine Code from being read after Programming.