Electrical Design and Motors
The electrical design consists of a battery, voltage regulators, the Raspberry Pi 4, the Intel real sense camera, DRV2605L haptic motor controllers, and linear resonant actuators (LRA) vibrational motor. The battery connects to the input of voltage regulators which reduce the voltage down to 3.3V and 5V for the Pi, I2C multiplexer and motors controllers to draw power from. The Pi further powers the camera via the USB 3.1 port. This powers all the components, and the remaining connections are for data transmission. The Pi sends out a single over I2C to the multiplexer which forwards it to the appropriately addressed motor controller. The motor controllers decode the data into haptic waveforms that are played on the motors. The waveforms can range from audio sequences to plain amplitude waveforms. The electrical schematic is shown below.
Expanding upon the schematic, most connections are self-explanatory except for the use of the multiplexer. Why couldn’t all the motor controllers be connecting to the I2C directly and all controlled at once? Well, the answer is they probably could except all the motor controllers have a fixed address on the bus, therefore sending a command to one motor controller will send the command to all motor controllers and all the motors would act the same. Since the address of the motor controllers can not be changed, we need some way to address each motor individually and this is where the multiplexer comes into play.
The multiplexer takes into an input on the SDA and SCL lines and then maps them from SD0, SC0 to SD7, SC7 using a 3-bit address on pins A0, A1, and A2. 3 bits allow the address to go from 0 to 7 corresponding to the 7 output lines. An alternative approach is to send the multiplexer a 7-bit binary message that is one-hot encoded which the bit index representing the corresponding output line. The software to select a port in python looks like this.
The code initializes a bus and using the multiplexer address of 0x70 in hex, it sends a one hot encoded byte to select the correct output on the multiplexer. Now that each motor controller can be addressed by the Pi through the multiplexer, each motor controller needs to be initialized.
The number of motors connected to the multiplexer is set, then each motor controller is selected using the multiplexer code, the motor controller is initialized, the motor controller is put into real time mode, the motor type is set to LRM(LRA) and the corresponding library is set as 6 according to the datasheet of the motor controller. The real time mode allows the motor controller to receive values between 0x00 and 0x7f which translates to 0% to 100% motor vibration. The motors are operational, and each motor can be assigned a unique power level to vibrate at.
Comments