Week 11: Interface and Application Programming

Interactive Brain - Beta Application Interface

Nov 30, 2016

For my final project, I wanted to make an interface where by touching a region of the physical brain, the user can read a short description about it on the screen.

Assignment

Write an application that interfaces with an input and/or output device that you made.

Main tools used this week: Python, pyserial, python launchpad, Tkinter, Javascript, serialport, npm.

Programming the Board

I built upon my code from last week, which had a tx/rx sensor and an LED array on it. Since the board will be embedded in a casted brain, what the tx/rx sensor needs to sense is the change in E-field, not its absolute value. I got an idea for how to do this from Harry McNamara's code. Here in the c code, I keep track of the last rx value and the difference between current and last value is higher than a threshold, then the lEDs turn on.

Here is the code.

And it works!

Application Programming with Tkinter

I used the pyserial library for serial connection with the device. I wanted to make a simple interface with Tkinter with a homepage and a separate page with desctiptions for each region of the brain. Right now, I only have one pressure sensor for a single region connected to my device, and so one page for a region. Next week, when we do networking and communication, I will add a separate page for each region.

Here is the code for the user interface, with no device communication.

It works as expected.

This is the combined code. What it's supposed to do is to take serial data from the device and if it senses a change in E-field larger than the threshold, make a new page with descriptions for a certain region. But I didn't know how to keep track of the last serial read. So what it does now is to see if the absolute value of the current output data is larger than a threshold. If so, the description page pops up.

I also didn't use the canvas widget, which allows you to update graphics in real time. This widget might be useful later when I have multiple senseors and need the graphics to change depending on which sensor is active.

I also wanted to learn javascript. I didn't have time to get far, besides setting up the environment and figuring out how things work.

Welding recitation

This week's recitation was on welding in the CBA shop. One of the coolest things I did this semester!