BACK to START

FINAL PROJECT / WEEK 1 / COMPUTER AIDED DESIGN / COMPUTER-CONTROLLED-CUTTING / ELECTRONICS PRODUCTION / 3D SCANNING & PRINTING / ELECTRONICS DESIGN / COMPUTER-CONTROLLED MACHINING / EMBEDDED PROGRAMING / MECHANICAL DESIGN / MACHINE DESIGN / INPUT DEVICES / 3D MOULDING AND CASTING / OUTPUT DEVICES / COMPOSITES / EMBEDDED NETWORKING & COMMUNICATIONS / INTERFACE AND APPLICATION PROGRAMMING / APPLICATIONS AND IMPLICATIONS / INVENTION, INTELLECTUAL PROPERTY, AND BUSINESS MODELS / PROJECT DEVELOPMENT

Week 16 Applications and Interface

Mai 18 - Mai 25

Lecture, Video

*Weeks Assignment*

write an application that interfaces with an input &/or output device that you made

For this week my goal is to make a space invader game and control it with my input hall sensor. I also want to try out a couple of different programming languages and frameworks I have not tried yet like Scratch for Arduino andn Openframeworks.

Connect an Input Device with your Computer

First you need to take one of your input or output devices and connect via the FTDI Cable to your Computer.

To understand Serial Communication better I read this article from Sparkfun which explains data bits, synchronization bits, parity bits and baudrate.

A serial bus consists of two wires TX (Transmit) and RX (Recieve). As I wanted to use my hall sensor I connected the cable to RX of the computer and the TX of the Hall Sensor. So the RX from one device goes to the TX of the other device and vice versa.

Serial with tkinter

Then I tried to adapt the python program from Neil to create an my own interface. I want to to a Speedometer for my final project so I tried to create a Speedometer interface with tkinter.

I did a tkinter tutorial first. And then programmed a needle interface in python.

Then I adapted a program from Francisco to switch between kmh and mph and show the speed digitally. I am planing for my final project to calculate the rpm with interrupts on my attiny and then make the math for km/h and mph on my interface. You can find all the code under Project Files on my google drive.

First make sure that you have the C code of Neil uploaded. If not upload the C Code again with

sudo make -f hello.mag.45.make program-avrisp2

Then start the python code.

python hello.mag.45-circular.py /dev/tty.SLAB_USBtoUART

or ..

python3 speedometer.py /dev/tty.SLAB_USBtoUART

Switch betweend the different modes.

m --> milesmode
k --> kmhmode
s --> modSelect
q --> sys.exit

Here you find a Video proofing that my application works.

Also I made a video showing my needle program.

Serial + Openframeworks

Also I wanted to try out t read a serial and write an Openframeworks Application. Luckily there already exists a serial communication example. I just need to change the tty of my FTDI Kabel to read the serial data of my input invader.

In my case it is this.

serial.setup("/dev/tty.SLAB_USBtoUART", baud);

Then a friend helped me to do create a tachoneedle.

Ok at least I am reading something. Now I need to think about a nice interface that shows me km/s, average and max speed.

I want to come back to here to also make my speedometer interface also in openframeworks.

For that I am going to the documentation of openframeworks to undestand the system and then also looked at the Documentation for Serial Communication.

I created a fist app with the ProjectGenerator and then tried to get the serial connection going with uploading the firmata sketch to my hello_world board with arduino.

Project Files

Download all project files from this assignment from my Google Drive or directly here from the repository.

hello.mag.45-circular.py

speedometer.py

Learnings

Feedback

Twitter me or email me at andreasrkopp at gmail dot com.

Or chat with me on gitter.

Gitter

previous week <-----------BACK to TOP-----------> next week