Welcome to my blog #3 of Smart Brain Training using MAX25405 Evaluation Kit. Here we will be testing Maxim Gesture Sensor EV Kit GUI and Python Serial Test application. You can find my previous blogs here: #1 Idea & #2 Getting started.
Maxim Gesture Sensor EV Kit &
In my previous blog, I shared how to set up the hardware and install the GUI from Maxim. As mentioned earlier, the GUI is simple and easy to interface with. We can select the Heat Map, Gesture, and Proximity tabs, which allows us to visualize the data.
- The Heatmap view gives a visual representation of the raw IR values with 6x10 blocks of data. We can adjust the sensitivity and the threshold using the Bias & filtering & Pixel clamping options.
- The gesture tab identifies pre-defined gestures such as Swipe left, right, up, and down. It also identifies Rotate CW, & CCW.
- The proximity tab divides the sensing range into segments. We can divide the range into rows & columns that can be calibrated.
Serial Port Setup
As a USB device, the EV kit shows up as a COM port called Maxim Serial Port. The serial settings are as follows:
- Baud Rate: 115200
- Data: 8-bit
- Parity: None
- Stop: 1-bit
- Flow Control: None
We will be sending the following commands: ping & poll. Ping command verifies communication at the processor level. The processor responds with an 'ACK' string. A poll command is used to retrieve gesture results from the EV kit. The poll command returns a data packet as a new-line ('\n') terminated string, with comma-delimited fields, in the following format: '[field 1],[field 2],…,[field 10]\n'
From my understanding, the reg read 0xA1 2 prints the two register values stating from 0xA1. With these commands, we will be configuring the registers.
To turn on analog mode, with a gear ratio of 10 (10 finger rotations = 1 dial rotation), and to turn off analog mode. (Digital dial mode, 1 finger rotation = 1 dial rotation). To enable all gestures including the CW and CCW rotations, send the following command:
0x7F // Enable all gestures
On running the poll command, the following response is obtained. The poll command returns 10 parameters, where field 1 is the gesture result. We will run a python script to identify the gesture from the EVAL kit.
Gesture Results Descriptions
This section describes the gesture results data obtained by the poll command.
Gesture Result
The gesture result values can be the following:
0 NONE
1 CLICK
2 ROTATE_CW
3 ROTATE_CCW
4 SWIPE_LEFT
5 SWIPE_RIGHT
6 SWIPE_UP
7 SWIPE_DOWN
8 RESERVED
9 RESERVED
10 LINGER_ON_REGION
11 RESERVED
12 ERROR
Install the pyserial package using the following command.
if serialPort.in_waiting > 0: # Read data out of the buffer until a carraige return / new line is found serialString = serialPort.readline() # Print the contents of the serial data try: decoded_string = serialString.decode("Ascii") #print(decoded_string) gesture = decoded_string.split(",", 10) #print(gesture) if gesture[0] == '0': pass elif gesture[0] == '1': print("Gesture Detected: Click") elif gesture[0] == '2': print("Gesture Detected: ROTATE_CW") elif gesture[0] == '3': print("Gesture Detected: ROTATE_CCW") elif gesture[0] == '4': print("Gesture Detected: SWIPE_LEFT") elif gesture[0] == '5': print("Gesture Detected: SWIPE_RIGHT") elif gesture[0] == '6': print("Gesture Detected: SWIPE_UP") elif gesture[0] == '7': print("Gesture Detected: SWIPE_DOWN") except: pass
Now we have tested a basic python application using the MAX25405 EV kit. We will use the Gesture sensors with the Raspberry Pi in the next post. Follow to know more about the project. Thanks for reading,
Top Comments