Write an application that interfaces with an input and/or output device that you made.
Group assignment:
Compare as many tool options as possible
Group assignment
You can find documentation about our group assignement on our group page.
Tkinter hello.switch test
The first thing I wanted to do this weekend was to use my input device board to interface a pressbutton pressed or not.
It is convenient since it already has button and a FTDI header.
I had never used Tkinter but I am confortable enough with Python and since there is many example wrote by Neil, I though it would be easier to go this way to complete the week assignement.
So I copied Neil's hello code for motion detection and modified for my purpose.
I uploaded the code below to my board to detect and send 1's when the switch button is pressed:
At first I was just sending 1's when the button was pressed and nothing when it was released. But the ser.read() python command wait for something to be written and my Tkinter interface could'nt print that the button was released.
By sending 0's everything went alright.
Matrix detection interface
My second objective for the week was to build an interface to represent the matrix detection of my chess pieces. The picture below show the vynilcutted copper tape matrix with or without the 2mm thick medium panel on top of it.
For the arduino I used the code below.
For the Python code I used the code below
The video below show the result of the detection.
I used the canvas tool in Tkinter to create the 4*4 matrix of squares.
The loop below allowed me to do them with equal spacing and to fill them in blue by default. I also gave a tag to every of them to know there position.
Then, on every loop, my computer read the data sent by the capacitive sensing board and compare it the trigger value at which it knows if there is a washer or not. If there is one, it turns the square to red otherwise, it turn it blue. This is done with the code below.
What can be improved
having the detection faster:
play with epsilon value
better understanding of capacitive sensing theory
avoid interference between each square:
sometime two squares appear to be detected because of only one washer this could be better managed with more signal processing
transfer code from C to python:
I transform floats to strings and then back to a list of float