Sunday, December 18, 2011 4:07:19 PM
python, usb, avr, hardware
...
During November I finally finished my college! Now I got a Bachelor's Degree in Computer Science by UFRJ (
Universidade Federal do Rio de Janeiro).
And for my senior project (or final graduating project, or
TCC - Trabalho de Conclusão de Curso, or
PFC - Projeto Final de Curso) I chose to build a USB device that could control the mouse pointer, using an AVR ATmega8 microcontroller and a magnetometer.
A magnetometer is a digital compass, something that can measure the magnetic field (in three dimensions). The idea is that the user holds the magnetometer and moves it around (actually, only the rotation is considered). When the magnetometer orientation changes, the measured 3D vector of the magnetic field also changes. Based on this vector, the microcontroller applies some math and moves the mouse pointer to some position at the screen.
In a nutshell, the device behaves like a
Wiimote, but using a completely different technology. You just point the device to some direction, and the mouse pointer is moved to that position.
Since the microcontroller implements the
USB HID class (using
V-USB firmware-only USB implementation, by OBJECTIVE DEVELOPMENT Software GmbH), it works straight away on any operating system without requiring any special driver. It has been successfully tested on Linux, Mac OS X and Windows. It was also tested on one Android device, but it did not support an absolute pointing device.
Links
VideosDispositivo apontador com interface USB usando magnetômetro (English subtitles available)
Moving the mouse pointer using head movements
USB Absolute Pointing Device implemented in ATmega8 using Magnetometer (work-in-progress video)
This project was challenging and very rewarding. It feels good to see it working after so many weeks staying awake during the night developing and debugging it.
Trivia: the idea for this project was inspired by Marcin Wichary speak/demonstration at
Google I/O 2011: The Secrets of Google Pac-Man: A Game Show


Sunday, December 4, 2011 6:52:16 PM
windows, linux, nvidia
I have a notebook with Nvidia 9500M GS. This videocard has "crashed" a few times already. These "crashes" can be identified as the screen freezing for a few seconds, and a glitched screen after it unfreezes. This glitched screen can be described as lots of small squares (2x2 pixels) appearing randomly over the entire screen. It seems like the video texture buffer for drawing the screen got corrupted. Also, over time those squares tend to fill up the entire screen, but they are cleared after switching to another window or doing something that forces a full redraw of the window (in other words, after sending new fresh data to the video card).
It has happened on 2010-03-09 while I was playing Bob Came in Pieces in Windows. (
nvidia-crash-2011-03-09.png)
Later it happened again on 2010-06-10, also inside Windows. (
nvidia-crash-2011-06-10.png)
But last month, in 2011-11-14, it happened while I was inside Linux. I wasn't doing anything "heavy". Actually, at that exact moment I was switching around workspaces using
Cube plugin from Compiz and I had very few open windows. (
nvidia-crash-2011-11-14-001.png,
nvidia-crash-2011-11-14-002.png,
nvidia-crash-2011-11-14-003.png,
nvidia-crash-2011-11-14-004.png)
The following message was sent to the system log right after the videocard crashed:
NVRM: Xid (0000:01:00): 13, 0003 00000000 00008297 00000f04 3f266666 00000040
The solution for these crashes? Rebooting. Actually, maybe it might be required to power off the computer and then turn it on after a few seconds.
I don't know why they happen, or how to avoid them, but at least they happen very rarely.



Thursday, October 13, 2011 11:45:00 AM
X.org, linux, nvidia, gentoo
...
This week I updated
x11-drivers/nvidia-drivers from 270.41.19 to 275.09.07, and I found a bug. Any window that is smaller than 32x32 is not correctly rendered. Since "tooltips" sometimes are quite small, it's very easy to hit this bug.
Update: It seems that version 285.05.09 works correctly.
Read more...

Thursday, September 8, 2011 9:00:00 PM
linux, pic, microcontroller, gentoo
...
Earlier this year, I had contact with a
PIC microcontroller as part of a college course. I'm documenting here everything I learned, and also making a comparison between PIC and
AVR.
Read more...
Wednesday, August 10, 2011 5:30:00 PM
avr, microcontroller, atmega8
Almost 4 years later, I started using AVR microcontrollers again. However, today it is difficult to find a computer that has a
parallel port, and thus I need to revisit this topic of AVR programmers. And I end up building (and buying) the
USBasp programmer.
Read more...