I'm quite a newbie to Arduino and hardware & circuit board stuff, so please forgive me if you feel my questions are too stupid. Recently, I'm working on an assignment which I have to reconstruct a mini claw machine by replacing the original controlling board with Arduino Mega2560.

In the process of doing this assignment, I encountered two major problems.

  1. Rubber keypads This is a picture of the rubber keypads board (https://drive.google.com/file/d/1-F4tUf4xjSPvxVJc11CLJ1wUbj1H0KK3/view?usp=drivesdk), there're six wires out there which were originally connected directly to the original controlling board. My question is, what pins do I connect from each of the wires to my Mega? ( which wire to GND, digital pin..... etc.)

  2. DC motors & LCD Here are pictures of the DC motors, LCD screen and a board which was originally attached behind the LCD screen (https://drive.google.com/folderview?id=1-5Jk-Q3Oj5ScWiegTgQ6xtZZwMNhn7mc). There are eight wires connected to the board but on the other side has only five wires originally connected to the original controlling board. My question is, what pins do I connect from each of the five wires to my Mega? ( which wire to GND, digital pin..... etc.) And how do I control the DC motors and LCD screen just by the five wires? (just need explicit concept explanations, but if there's some example code would be grate)

If you need me to provide more information or pictures, please feel free to ask.

Thanks for all !

  • 1. Seems to be a button matrix. 2. I don't see a real servo at the pictures, only DC motors. I see 3 of them, which would correspond to 6 wires. Please show, where each of the 8 wires goes – chrisl Jun 15 '19 at 13:15
  • And where do the 5 wires from the other side of that board go? – chrisl Jun 15 '19 at 13:16
  • @chrisl hi, thanks for stoping by. 1. can you be more specific about the pins that each wires has to go? 2. thanks for correcting me, they're actually DC motors. I've renamed all photos and added 2 photos of the DC motors and a photo where each of the 8 wires goes and another photo of the original board where the wires at the right side are from the board behind the LCD screen. – Øø Øø Jun 15 '19 at 15:11
  • 1
    1. it is up to you to decide which arduino pins you will use for inputs, then you write the code accordingly ... the swich matrix is very simple, trace which pin goes to which switch ... draw a schematic diagram and add it to your post .... one of us will check it for accuracy – jsotola Jun 15 '19 at 16:50
  1. The button pad: I tried to follow the copper traces as good as I could (some are covered by the rubber knobs). It seems, that each button has 1 seperate pin, but all share one common pin. See the following picture, where I marked the buttons the the corresponding pins:

button pad

Connect the "GND" pin with ground and the other pins with digital input pins of the Arduino. Be sure to use the internal pullup resistor via pinMode(pin, INPUT_PULLUP). You can then check the button state for each pin with digitalRead().

  1. LCD and motors: This one is more complex. First see the picture of the LCD/motor board:

LCD and motor board

1 is an extra microcontroller, that handles the LCD directly over the lines marked with 4. 2 and 3 are brushed DC motor drivers, to be exactly: 2 (part number MX1805) is a dual H-brigde driver and 3 (part number MX612) is a single H-bridge driver. So enough drivers to drive the 3 DC motors in both directions. The 5 lines, that come from the main board of the claw, seem to run under the driver board and then to the microcontroller. Two of them must be the power supply (5V and ground). It seems that the green wire is ground. Red seems to be 5V. That leaves us with 3 wires, that come directly from the main microcontroller. Without analysing the signals, that run through these lines during operation, it is not possible for me to say, how they are used.

So I think you have 2 possible ways to go:

  1. Reuse the old LCD/motor board: In this case you will have to analyse the signaling through the three mentioned lines and do the same with the Arduino. That is possible, though difficult especially for beginners. You will need an oscilloscope or a logic analyser for this (They are extremely useful tools, so it might be good to buy that anyway).
  2. Build the electronics yourself: You can buy relatively cheap LCD modules, which are interfaced via I2C or SPI and where there are ready to go libraries for Arduino. For the motors you can either desolder the old motor drivers, buy your own or build your own with MOSFETs. The important term here is "H-bridge", which means the way in that the MOSFETs are arranged. There are many tutorials how to use H-bridges with motors on the web. If you buy driver chips, be sure to use those with MOSFETs, which are way more efficient than older types.

The second type means doing more yourself, but you will not have to reverse engineer the old electronics, so I think, that would be easier. Each task is simple for itself and you can solve them one by one. The first option on the contrary will leave you with the one relatively difficult task of reverse engineering the communication protocol.


I have thought of 2 basic possibilities for the 3 lines from the main controller to the secondary controller.

  1. They might be data lines, where some kind of communication protocol is transmitted. Most likely that would be I2C, UART or SPI.

    • I2C is a 2 wire interface, so the third line might be a simple digital line (maybe for triggering something). For I2C both lines are HIGH (at Vcc level) when idle. You can check that for the lines with a simple multimeter. Also you can use an Arduino and try to attach it's I2C hardware interface to it. The Arduino would be the slave device and needs an address. Here you would have to test every address, until you find one that works (There are 127 addresses in normal mode). You would have to test a lot for this (also rotating the wires, as you don't know, which one could be which I2C line), and it's not guaranteed to work, even if it uses I2C.

    • SPI is a 3 wire interface (clock, MasterInSlaveOut, MasterOutSlaveIn). Also for SPI every chip has an extra line for chip select. Since here we only have one chip, that would be hardwired. Connect the Arduino's SPI interface to the 3 lines and test, if you can get any data from it with any permutation of line connections.

    • UART uses 2 wires (RX and TX). You can hock up the RX line of your Arduino to any of the lines and try to get any valid data there. You would have to test all the common baudrates and hope, that they don't use uncommon ones. Maybe it is simpler to instead hockup the TX pin to the lines. That would connect the receiving pin of the UART-USB transmitter, so that you can directly see the data at the PC (some serial terminal programs can guess the correct baudrate). In this case be sure, that the Arduino will not send data over Serial at any time, because that can destroy things. Best remove the microcontroller (if you have a removable one) or load a sketch without the Serial.begin() or any other Serial statement.

  2. They might have decided during design, that the LCD does not need data from the controller, but should only display information from the motors. You can check for that a bit. If the LCD shows any information not regarding the motors but the input from the controller, this point is not applicable. If not, the three lines might be simple PWM signals for the three motors, with a duty cycle of 50% meaning stop. To test this, you can attach one LED to each line (including a current limiting resistor). The other end of the LED goes to ground. When using the buttons to control the claw, you might see the LEDs dimming or lighting up exactly for the motors powered (1 specific LED for 1 specific motor). Don't forget the current limiting resistor for each LED, or you might fry the controllers pins.

That's about what I can think of to reverse engineer this without oscilloscope or logic analyzer. Since neither of this seems very easy for a beginner, maybe you should ask your professor for help. He might be able to give you hints or at least an oscilloscope to work with (most universities should have these). If you get a good oscilloscope image from the lines during transmission, you can ask a question to identify the used protocol.

|improve this answer|||||
  • hi, thanks for such explicit explanation! Now I'am able to control the keypad. The problem left is the LCD and the motors. This assignment given by my professor is to simply replace the original controlling board with Arduino, so your second possible way won't be suitable (but thanks anyway). After testing, a full screen light would show if I connect the green wire to 5V and red wire to GND. I'm planning to buy a oscilloscope, but it would be too late when it arrives, so is there any other ways to test or any suggestions? – Øø Øø Jun 15 '19 at 21:20
  • Mhh, I assumed that it is using some communication protocol between the microcontrollers to send information, like UART, I2C or SPI. That case is difficult without any means of analyzing the data. I will add some thoughts about that to my answer – chrisl Jun 15 '19 at 21:31
  • The second possibility, that just came into my mind is, that the three lines are just 3 PWM lines for the motors. In that case the display would only show information, that it knows from the motors, nothing from the main controller. I'll also add that to my answer – chrisl Jun 15 '19 at 21:34

You said: "This assignment given by my professor is to simply replace the original controlling board with Arduino..."

Isn't the controlling board all one unit, with the LCD controller, motor H-bridges, and general microcontroller?

If you replace the controlling board I think you'll have to replace the motor drivers, and probably the LCD controller as well. I don't see how you can replace the logic function with an Arduino without replacing the entire controller board.

I would do what chrisl suggests, and get an SPI or I2C LCD display, 3 dual H-bridge motor controllers, and an Arduino. You could use the existing motors and the keypad, but reusing the LCD display would mean reverse-engineering it, which is no small feat.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.