14. Networking and communications¶
Group Assignment¶
In this week’s group assignment we did some experiments on communicating between boards via TTL protocal. During the assignment, I know more about how to work with the serial ports on SAMD11C. Use Serial to send messages via USB port to the computer and use Serial1 to send messages via PA31(RX1) and PA30(TX1).
Individual Assignment¶
This week I work on the remote control part of my final project. I choosed a PS3 Dual Shock Remote as the controller to control the Fab Kart. Because I use ESP32 as main controller, the on board Bluetooth connectivity can be direct connect to the Dual Shock Remote.
PS3 Dual Shock Remote Specs¶
Item | Details |
---|---|
Connectivity | USB, Bluetooth (PS3 and PSP Go) |
Power | Lithium-ion battery (3.7 V 300 mA or 5.0 V 500 mA), USB host powered |
Dimensions | 160 mm × 97 mm × 55 mm (6.30 in × 3.82 in × 2.17 in) |
Mass | 192 g (6.77 oz) |
Getting the paired MAC address of Dual Shock Remote¶
The Dual Shock Remote will remember the MAC address of the console once it’s connected to the console with a USB cable. To connect the Dual Shock Controller and the ESP32, the first thing is get the console MAC address recorded on it. A software called SixaxisPairTool can read or change the recorded MAC address.
-
Click this link to download and install the software on a windows PC.
-
Connect the Dual Shock Remote to the PC with a Mini USB cable.
-
Run SixaxisPairTool, the recorded MAC address should be show similar to the above:
-
Copy the MAC address for later use, or change the MAC address to other value if needed.
-
Go to this page and install the required library to Arduino IDE.
PS3 Remote Button Test¶
I open and modified the demo sketch “PS3Demo”, replacing the MAC address recorded at the previous step.
The library assigns two events for every button: button_down and button_up. In this demo, the there will be a message sending from ESP32 to its serial port when buttons are being pressed or released.
PS3 Remote Controlling Motor¶
After confirmed the library and Dual Shock Remote works, I modified the code and add motor control parts to the sketch. Now I can control the motors by pressing buttons on the remote. When the Cross button was pressed down, motor will spiin forward. When the Cross button was relesed, the motor will stop spining.
References & Download¶
Ps3Demo.zip Ps3_Motor_Control.zip esp32-ps3