Progress has been made with the help of @chris101 and @JackANDJude
Last night I was able to:
- Connect the Arduino bit to my I/O board, successfully.
- Connect the keyboard bit to my Arduino bit.
- Connect a bargraph and two LED bits to the Arduino bit to indicate which motor and which direction had been selected. This needs improvement, but it is not a high priority.
The my program let me press a key on the keyboard to activate one of the relays on the relay board. This eliminated the eight small pushbuttons that I had attached to the I/O board. The buttons worked, but it was messy with wires running everywhere.
After a fair amount of time and testing, I discovered some interesting things about the keyboard.
- The ‘note’ that is sent when you press a key is not always the same. It will be close +/- 5 beats, but not consistent.
- The note frequencies (values) do not match the frequencies of a typical piano keyboard.
Since I wanted my program to react in a specific way to each key press, I needed a way to group similar values as one action.
I finally settled on switch/case. One case (key) might look like:
Take some action;
So, any of these five note values will trigger the same action.
to keep matters simple I will use only the lowest octave range setting on the keyboard. It would not be that difficult to use any of them, but that is for a future update.
Once everything is in place I had two problems:
Getting the correct power value in the right places
The relays were activating randomly. There was a lot of chatter when the program started up.
I finally connected the 5v GND from the I/O board to the GND pin on the Arduino bit. All the chatter on startup went away and no random relay activations were noted. Thank you @chris101
I think I can reduce the external power source requirement to a single 12V 2.5 amp power plug. I will add a voltage regulator to get the 5v for the I/O board. The power bit will accept up to 12v so that is a single source. Once the program is loaded on the Arduino bit I should not need the USB connection to the PC.
The next test is to actually connect the wires from the I/O board to the robot arm. I have done this for one relay, but not all eight.
Left to be done:
- Determine how to monitor the position of each motor so I “can’t” try to move a motor too far in one direction. Set right left boundary values for each motor.
All the I/O board does is provide a pulse of electricity to a motor. There is no number (position) associated with that pulse.
Add a program controlled switch to turn the light on. The robot arm has an LED light mounted above the gripper.
Add a two relay I/O board to control the fifth motor on the arm.
Right now I use two relays for each motor, one for each direction of movement. Since there are five motors (need 10 relays) and the I/O board only has eight relays, I am two short.
I bought a new board that will control up to twelve servos, but that is not the same as motors. I am looking at a long-term servo solution, but that is not now.
There are unused keys on the keyboard for the light and the extra relays, so it should be a “simple” matter to get these last steps working.
- Break the physical project into two parts and connect then with the wireless bits.
That must mean that I am 90% finished with this project.