Jon's Blog

Saturday, July 31, 2010

I realize I've been kind of quiet about it on my blog, but for the next few months, I will be in Belize learning electronics from my Uncle, who works quite a bit with electronics. Today is close to my third week in Belize, and it's been pretty busy so far. I don't have much opportunity to use the internet, so that's why I'm just now writing for the first time.

Living out here in the jungle, there are no public utilities, so my Aunt and Uncle provide their own infrastructure. For electricity, the house is powered off of two large arrays of solar panels, which charge an array of 12 lead-acid batteries. The DC voltage is converted into 120 V AC supply using a converter and inverter. During cloudy days and days during heavy energy demand such as when the washer and dryer are being used, a gas generator is used to power the house up. I've found I have to be very careful to turn off lights behind me and unplug all unused electronics, because it is easy to overload the system and cause it to shut down. I simply need to plug in my laptop sometimes, and the entire house loses power.

Water is collected from rain water. The roof of the house is designed so all the water that hits the roof flows into gutters, and is collected in large tanks. The water is then heavily filtered and supplied to the house at 40 psi. There is no hot water, so all my showers have been cold lately; it's not a big deal in this climate, anyway. Right now, I'm staying in the guest house, which is its own separate building apart from the main house, consisting of a bedroom and bathroom. The house has it's own separate water collection system, and the electricity is supplied using an extension cord from the main house.

The first few days here, I worked through a few Electrical Engineering problems, refreshing myself on concepts that have been taught to me during my time at the University of Washington. After my crash refresher course, I was put on a project of getting a 6502 microprocessor emulator device my Uncle built before I was even born to work again, and to upgrade the memory on the board. Originally, the project entailed just getting the circuit working. I was a bit intimidated looking at the tangled mass of wires, some of which have become disconnected, so I need to figure out where they used to go. Also, I was relatively new to soldering when I came down, and the last couple weeks has been a crash course into how to solder together prototype circuits. Soon, the project evolved into modifying the circuit to include an updated SRAM, since they evolved since he designed the circuit. Later, I found there were major revisions to the circuitry I needed to make to cause the circuit to run properly, so I ended up taking a lot of the circuitry apart and rebuilding it, and improved on the design quite a bit. I'm in the process of testing the logic and rewiring the circuit, and I have a feeling this project might take a while longer before I'm even ready to start programming it with Forth (a stack-based microcontroller programming language which very few people use, because it was oversold in the 1970's). After that, I might design a control circuit for a gas generator, which automatically starts and shuts down the generator to ensure adequate battery voltage. Also, one of the Mennonites at a hardware store is requesting a microprocessor-based grain dryer controller, which might become one of several entrepreneurial opportunities I'll have while down here in Belize.

Being here with my Uncle is like having a personalized electronics tutor. I have been learning about electronics pretty much non-stop the last few days, and my brain has sometimes been in information overload mode. I have been learning all sorts of things about power electronics lately, which my uncle is currently writing a book on.

Anyway, I have a lot more to say, but I'll save it for a future post. I will at least attempt to write once in a while, and I'll try to upload images some time.

Saturday, June 12, 2010


Hello to all... Yesterday I finally graduated with a BS in Electrical Engineering after 2½ years at the University of Washington, Seattle. I don't know if it would have been possible without the support of my friends and family, and especially my Mom and Dad. Anyway, here's a small selections of photos from yesterday...

IMG_0145 IMG_0211

Left: In front of Suzallo Library.
Right: Me with Dr. James Peckol, with who I've had for a total of four classes, EE 271, EE 399, EE 472, and EE 478. He has a reputation of being one of the most demanding professors in (especially in regards to documentation), although, he perhaps prepares you better for industry than most professors.

Now that I've graduated, I have to now do a lot of organization, moving, and preparing for my Summer ventures to Central America for a while.

Tuesday, June 8, 2010

Embedded Keyboard Project, Part 6

Since my last post, our team has completed the final project. On Monday, we conducted the final demo, and just today, we submitted the lab report. Here is the final layout of the keyboard:

Completed keyboard project

As you could see, my lab partner Whitney did a fine job organizing all the electronics, securing them to the keyboard. He made a nifty stand for the LCD display using plastic risers and hot glue. As you can see, we're now using a Seeeduino board instead of the Arduino board -- which is for the most part the same circuit, except it has a few added features and a slightly different board design. Also, note the use of the infrared optoelectronic distance sensor on the lower left side of the board. We decided to make the circuit a little more complex, so we added what is known as a D-beam, and it is used in a lot of Roland synthesizers, for instance, the Lucina AX-09 (video -- WARNING: click only if you can handle extremely cheesy product infomercials). We implemented the D-beam using a Sharp 2Y0A21 distance sensing device, and we freed up an analog input on the keyboard controller for the analog sensor signal. We programmed the keyboard to process the same range of pitch bend as the Roland model in the video clip I posted above, which is about a whole step of range. The analog data coming from the sensor is really noisy, so it adds kind of like a chorus effect to the sound quality which we really couldn't filter out very well.

We reconfigured the entire keyboard to run off of USB power, which is 5 volts, 2.5 watts. The entire circuit ended up only running off of 1.2 watts. We could probably cut down on power even more, especially with the LCD, which consumed a half a watt.

Since our synthesizer output standard MIDI out, it was compatible with another group's project, which was designing the actual synthesis. In the following video, I used our project as a keyboard interface to their synthesizer using our MIDI output. Here is a video I shot of us connecting our projects together:

The overall cost of all the circuit components is just short of $100, which is more than the original keyboard was worth. We actually probably had the cheapest circuit out of all the groups. If we had more time, ideas I had for further developing our design would be to add a recording / playback feature, which I could very easily do with an SRAM chip, integrating the controls into the LCD menu. Since we ended up getting the synthesizer chip working in serial mode, all the parallel signals could be freed up to drive an SRAM chip. Here are the files that we created for our project:

final_presentation.ppt - Class presentation (Microsoft PowerPoint)
final_report.pdf - Final lab report (Adobe Acrobat) - Project source code (zipped)

Some of the other groups in the class ended up creating really cool embedded projects. Perhaps the most expensive project implemented was a series of robots which implemented swarm intelligence. The robots would scan an area for a target of a specific color, and when it found the target, it would wirelessly broadcast a message the other robots that it found the target, and emit infrared radiation in all directions. The other robots would then turn and locate the robot, and move in towards it. Here are some photos I took of their project:

IMG_0095 IMG_0106

Another cool project was one group that worked with a touch-screen LCD, which had applications which allowed you to draw pictures, play music, and operate a remote-controlled toy car. Here are some images of their project:

IMG_0115 IMG_0119

Another group designed an automatic plant watering system, which allows you to automatically water your plants when it senses the soil is too dry. You can also monitor if your plants are being watered on Twitter. I thought this was a really creative design idea.


Also notice the very creative white-board artwork. Over the weekend, there was an art competition in the lab. Here are some examples of peoples' creativity:

IMG_0100 IMG_0124
IMG_0092 IMG_0096

Notice that sleep is a common theme in the artwork. No doubt, many groups had to pull overnighters this weekend on their projects, and sleep deprivation seems to be a common theme in classes like this. Working on these projects, you completely lose perspective of time, and can easily spend over 10 hours on a project in one sitting. Well, continuing on with the artwork... One group decided to take their artwork a little further and etch their artwork onto a circuit board.

IMG_0121 IMG_0122

And here is my team's artwork, which my lab partner drew. It isn't nearly as creative, simply because we didn't have to spend overnighters in the lab this weekend, since we had our entire circuit working last Monday and completed on Friday.


One of the most amusing pieces of art in the embedded classroom is the "Wall of Death", which is a hodgepodge of broken microcontrollers, comic strips, and student artwork.


There were some other cool projects created this quarter, some which worked others that didn't. Dr. Peckol usually publishes all of our embedded projects on his web page. Our projects should be up and running on his site within a week or two. You could visit our class project showcase here (if it is even up yet). More photographs can be found on my Flickr page.

Tuesday, June 1, 2010

Embedded Keyboard Project, Part 5

Today, we made some last touches on our final project. We threw together a quick video with my new Canon Rebel T1i camera, demonstrating some of the capabilities of our project.

Sunday, May 30, 2010

Embedded Keyboard Project, Part 4

Hello, this is just another update on our keyboard project. I feel we got a *LOT* done since the last time I posted. The project is now going very smoothly, and we feel we are meeting our schedule very well. I feel like we are around 80% done. Anyway, I wanted to share with you the following recording:

Okay, I guess that's not my best recording yet, but after a few frustrating days of trying to get our ATSAM2195 Atmel synthesizer chip to work, we finally were able to produce sound output. This note was our first recording of the sound output off the chip.

Our final project circuitry actually fits on only one breadboard. We have a pic microcontroller, which has the task of reading all the key states, and generating NOTE ON and NOTE OFF commands to the synthesizer chip whenever a key changes value. The commands are then converted to MIDI messages, and sent to the ATSAM2195 synth chip.

Final project layout

In the image above, you can see our entire final project, minus the Arduino and LCD display, and minus the audio amplifier my lab partner built for this occasion. We decided to switch to parallel mode communication with the synthesizer chip, simply because we felt it was a bit easier to get going. Anyway, here is a quick and dirty c file we wrote for the PIC18LF4525, with which we were able to communicate with the synth chip:

Next we need to integrate all the code for the keyboard controller, so actual key events on the keyboard trigger MIDI commands.

What I spent most of my time on lately was creating drivers for the Crystalfontz CFA533-YYH-KL LCD screen, which is a 2-row 16-character LCD display with 6 navigation buttons. We're having an Ardueno Duemilanove control the LCD through a RS-232 connection. The navigation menu allows configuration of various things such as instrument, master volume levels, reverb, and chorus. We uploaded a list of the 128 different instrument sounds incorporated on the synthesizer chip.

We also incorporated commands to save current settings into the Arduino's EEPROM, and restore to default settings. The settings are coordinated with the keyboard controller via I²C connection.

Testbench for LCD display controller

The I²C communication ended up not being straight forward, since I had trouble getting the Wire.h Arduino library to trigger interrupts in the PIC controller when the Arduino is asking for a byte of data. I ended up writing my own Master I²C drivers, which pretty much bit-bang the SCL and SDA signals. Using my library, I was able to get the Arduino talking quite nicely with the PIC controller.
Our current code files for the LCD display and menu drivers are as follows:
arduino_module.pde - Arduino project main file
common.h - Shared constants between keyboard controller and LCD driver
menu_items.h - List of items in the LCD menu

As of now, the LCD driver is mostly complete, besides some later proof-reading. Also, I can think of a few more features I would like to incorporate if I find the time such as transposition, and I want to change some things about how the menu is displayed.

Anyway, next time I post, the project might be completely done, perhaps just over the 3-day weekend. I have just one more week to work on this project, during which time I'll be finishing the final project, preparing a 20-minute presentation on the project, writing one of Dr. Peckol's typically long lab reports, and conducting a demo of our design.

Monday, May 24, 2010

Last day at RPC

Yesterday was my last day as an organist at Resurrection Presbyterian Church, after 2½ years of providing services on the piano and organ. Members of RPC threw on a really nice reception for me, where I was given a farewell greeting. Thanks for everybody who put this together!

The reason I'm leaving is because I will be interning in Cayo, Belize, with my uncle, who is the head of a small Electrical Engineering company, Innovatia Laboratories. It's pretty much an internship, and I'll be getting personalized training from him. As of now, I'm not sure how long I'll be down there, but it'd be too much of an expense to fly up and play every Sunday. Although I'm not leaving until some time mid-July, these next couple weeks are packed with busy work for all my classes (if you haven't noticed by my other blog posts). I have to think about moving out of my apartment into storage, and figure out a way to get down there.

It has been my pleasure working with Pastor Scott. Now Saturday nights and Sunday mornings feel a bit awkward, since all the days of waking up super early to set up and practice and talk to Brooke for half an hour are now over. I've received a lot of positive feedback over the past couple months. I will definitely miss working there, and hopefully, I will find a similar job in the future. My goal is that as long as I'm alive, there will be at least one church with good music and good theology. Maybe one day, if I find a stable job in the Seattle-Tacoma area, I will be able to use my talents once again at RPC.

Saturday, May 22, 2010

Embedded Keyboard Project, Part 3

Today, I put several hours into the embedded project. My lab partner extended the 15-wire band by soldering on longer wires, then running the wires outside of the keyboard case, where they're much easier to access in a bread board.

In the picture, the black wires are for the key matrix rows, and the red wires are for the key matrix columns. We also broke out controls for the power switch on the keyboard and for the two speakers, and we think we probably will try to incorporate them into our design.

After probing the 15-wire keyboard bus, we determined the overall schematic for the keyboard matrix:

This matrix design is exactly as I had speculated in an earlier post. I got keyboard drivers working, which as of now, detects when any of the keys have changed state, and which keys changed. The driver works by driving one of the rows high and the others low, then reading in the columns. This happens repeatedly for each of the seven rows. The old values of the columns are saved and compared to the new values, and when a change is detected, that is when we process a key change, and send MIDI commands to the Atmel synthesizer chip. Here is a PIC16F877a microprocessor wired up:

As you could see, we found we needed pull-down resistors for the column pins. We found without them, we got misread key strokes, since the voltage on the column pins wasn't falling fast enough. We speculate the diodes introduce capacitance to the column pin nodes. We found 10 kΩ resistors are small enough to discharge the nodes in time for the next read.

The keyboard driver is currently written to toggle the LED on or off every time a key event is detected. The idea is, you press down one key, the LED turns on; press down another key, it turns off; release a key, it turns on again; etc. The current drivers for the keyboard controller can be found using the following links:

After pounding around for a while, we're now pretty certain that every key event is being processed correctly, since after all keys are released, the LED always ends up in the off state.

Pressing down one key turns on the LED

As of now, we're still using a PIC16F processor, which runs off a supply voltage of at least 4 volts. Our synthesizer chip runs off of 3.3 volts, and we don't really want to deal with level shifters, voltage regulators, or use multiple logic supply voltages. So we requested some free PIC18LF samples from Microchip, which should be arriving early next, which can run off of a 3.3 volt power supply. Once those arrive, we could begin to try to send key commands to the synthesizer chip.

So I feel the project is falling together pretty well so far. Next week, we will begin trying to interface the ATSAM2195 chip, and we're really hoping that we figure it out fairly quickly. As of now, I think all the soldering and modifications to the keyboard are complete. Just out of curiosity, I'm thinking about having my blood lead levels tested.