W16│ Machine Design

Group Assignment:

  • Actuate and automate your machine


Pins from alucyem on Vimeo.


Please click on the image to acces to our Mechanical & Machine Desgin

INIDIVIDUAL DOCUMENTATION

I was in charge of designing and programming the User Interface. I only had previous experience with app Inventor but for this assignment I wanted to try Python. There is a lot of information and tutorials, I started the design with Pygame, with it I was able to make the array and by clicking each square give them a color. But I needed to add two buttons to send the information and to reset it. Here I face several problems with Pygame. So I decided to use KIVI as a recommendation from Daniel (he works in the Lab)

Development


For the interface we tried to use Pygame, but it has some problems to define a grid, so we moved to KIVY, an open source library used to design interfaces. It allows you to work with grids, wich made things a little bit easier This interface works with a 8x8 matrix made of buttons. Each one has a color that changes every time you clic on it. We have chose 7 possible colors and defined them on an array and assigned a code for each one. We have indexed all the buttons with a code from 0 to 63. It also has a Reset button, that returns every button to its original state. Finally, it has a Send button. This is where the magic happens. The Send button uses serial communication to interact with the Arduino. It searches through the Matrix and if a button has a different color than the original (white), it sends a string with the position and the code of color of the button. It sends it using the following way: "M" + row (from 0 to 7)+ column (from 0 to 7) + "L" + color code (10, 20, .... 70) + ";".

How Kivy works

Kivy has several libraries andcan work with windows, android, etc.

code


FILES

Kivi: Code

← Previous Assignment → Next Assignment