To control the motors, both the legs and the dome (head), it is necessary to have three drivers that are capable of handling the traction motors and the one that makes the Dome rotate.
As I have foreseen in the system, it must also be able to receive information from the R2-Net bus, so that we can both control and handle the telegrams and thus carry out actions.
With which the objectives that I have set for this part of the project are the following:
- Receive data from a user interface (command).
- Check the information to the three motor drivers.
- Position the Dome and the Droid at any time.
- Receive data from the R2-Net bus sent from the server or from another R2-Net device
- Connect peripherals to interact with the droid, in our case an artificial vision camera.
What is going to be achieved with this:
- We can control the droid from a Sony controller (Traction motors, dome and some drives).
- We will have inputs with hardware interruption to have the possibility of connecting an Rc command.
- We will connect a hall type sensor, which we will activate in the zero position of the dome, this position will be when the droid is facing forward.
- Optionally we will have the possibility of connecting an incremental encoder, which will allow us to know in which angular position the dome is. With this we can place the dome in the angular position we want.
- Thanks to the camera, we will be able to recognize objects and perform actions so that the user can interact with the droid using artificial vision technology. It is also possible to trace colored objects or teach him patterns to identify them.
For all this, the best way is to have the Motor Shield, which is installed as an intermediate step between an Arduino Mega ADK and the drivers, while conditioning the R2-Net bus, the sensor, encoder and the vision camera.
The sensor that we use as the zero position detector is a hall effect sensor type A3144.
This sensor, as I mentioned before, is in charge of telling the arduino mega ADK that the magnet installed on the dome-plates coincides on it.
Both the magnet and sensor must be installed to match when the droid is facing forward.
THE ENCODER (OPTIONAL)
The encoder is incremental, not quadrature and what it does is count the pulses that are produced during the rotation of the dome. This is dependent on the gear ratio between the engine and the lazy susan toothed ring.
In this case the encoder will serve to position the dome as exactly as possible, it is not essential for any of the options that I am predetermining the droid, but it may be very interesting when making corrections or to have its angle rotation into account.
How does it work?
With the encoder connected and properly programmed, it returns 20 pulses each time its wheel turns one turn. These 20 pulses become 40 when the rising and falling edges of each detection are detected.
So, knowing the gear ratio of the dome sprockets, the motor sprocket and the encoder sprocket, we can easily calculate how many pulses we will have in each full turn of the dome.
With this data it is easy to get a transformation to degrees to establish the angular position or to know the angle at which it is knowing the pulses that it has counted.
On the right there is an image where the sensor and the encoder are connected in the Shield.
How are the encoder steps calculated?
The set of the relationship is made up of three pinions: One of the crown type (A) and two conventional internal ones (B and C). In my case the number of teeth of each pinion are:
- A (Lazy susan) – 95 Teech
- B (Motor) – 20 Teech
- C (encoder) – 10 Teech
We must know how many turns the encoder pinion makes with each turn of the dome (A). and then multiply the result by two when reading both flanks, for that we calculate it as follows:
Pulse/turn = (A / B) * (B / C) * Encoder pulses
Pulse/turn = 4.75 * 2 * 40 = 380 pulses
The value to be set in the arduino code for the pulses per turn variable is 380.
WIRING DIAGRAM (DC MOTORS)
WIRING DIAGRAM (BLCD MOTORS)