
Microtouch
- Transfer
Yes, iTouch is awesome. But who needs such a “closed” device? Maybe it’s better to make your own touch screen gadget, write your own programs - all using free hardware and software? Well, yes, this gadget may not be able to play MP3s, but it does have a color touch (resistive) TFT screen of 320x240 pixels, an 8-bit Atmega32u4 microcontroller, a charger for lithium-polymer batteries, backlight control, a microSD slot and a three-axis accelerometer. A curious little thing, especially for those who like to do something with their own hands, what do you think?


Of course, one scheme and wishes of luck are clearly not enough. Therefore, the creator of microtouch (which we know by the code name " Rossum ") wrote an operating system and several demo applications , for example:
The project is the result of a collaboration between Rossum and Ladyada, developed in California and New York.


Microtouch's brain is the Atmega32u4 in a TQFP package. The chip has built-in USB support and many contacts.


The board has a charger for 3.7 volt lithium-polymer batteries (MCP73812). The battery must be connected to the 2-pin JST-PH, remembering to check the polarity before connecting. The charger circuit is very simple, but it charges the battery normally. The charging current is approximately 250 mA, so do not turn it on to the hub without additional power. Most likely it will be charged from any computer. Unfortunately, there is no (for example, LED) notification that the battery is charged, but you can determine the status of the battery through the ADC of the microcontroller. You can change the charge current by changing the resistance of R17. Read the datasheet for MCP73812 to find the resistor for the desired charge current.

Battery (or USB) leads connect to the LP2985 3.3v LDO. This regulator is of very good quality, giving approximately 1% error and current up to 150 milliamps. In the microtouch circuit, 4 backlight LEDs consume the most current (up to 80 mA total). In addition, the microcontroller eats 10-20 mA, about 20 mA takes the TFT, and another 2 mA - a red LED. The accelerometer practically does not consume energy.

This LED is connected to PC7 and is used to indicate bootloader activity. You can use it as you like.

The frequency of the crystal oscillator is 16 MHz. This is a small Atmel overclocking (at 3.3V it is better to use a frequency of 12 MHz); We test the microcircuits for functionality before sending. The reason for overclocking is that you can make a quick graphical interface. Near the quartz are two stabilizing capacitors.

Microtouch uses a trick that allows it to turn off when powered by battery. LDO has an “Enable” output that is shorted to common (that is, LDO is disabled by default). When the rectangular power button is pressed, LDO is turned on, which turns on the AVR. The first thing that the AVR does is to output “On” (it is connected to PF0) a high logic level. When the power button is released, this pin will keep the LDO operational. This means that if you are writing your code for Microtouch, first of all make sure that PF0 is in output mode and pass a high logic level to it.
Accordingly, to turn itself off, the controller can lower PF0 to a low level. The user will have to press the power button again to turn on the microtouch again. Do not do this when the device is powered by USB, because the bootloader may freeze. Pressing “reset” will bring the device out of the frozen state.

A reset button is connected to the AVR reset pin. It can be used to start the bootloader. If you overwrite the bootloader, it will simply restart the device.

AVR can be reflashed with any standard AVR programmer, avrdude, or something similar. During the firmware, do not forget to keep the power button pressed, or connect the device to miniUSB, or supply power (3.3 volts) from the programmer. Make sure the power is actually 3.3 volts. USBtinyISP, for example, gives 5 volts, and such a voltage can damage the screen.

As the screen backlight, 4 white LEDs are used, connected in parallel. We use 22-68 Ohm resistors (68 in the image, the value may vary depending on the screen model) on each cathode. The cathodes are connected to pin PC6. You can change the backlight by changing the voltage at the output. When the backlight is off, nothing is visible on the screen.

MicroSD and microSDHC flash cards are supported.

The microtouch has an MMA7455 accelerometer for moving data. The accelerometer can detect movement and shaking. It can be set from + -2g (for high accuracy) to + -8g. No need to drop Microtouch to test the accelerometer! It’s better to use the Accelerate app for this.

You can use the USB connector to download new firmware to microtouch. The bootloader takes up 4 KB of memory. The bootloader itself can be rewritten using the AVR ISP programmer.
You can also use the USB port to charge the battery. You can run Microtouch from USB, but since the charger is connected directly to LDO, the USB port will not be able to provide the necessary 100-150 mA. As a result, the core detects that the voltage is too low, and reduces the brightness of the backlight. That is why the screen is not as bright as when powered by a battery.
To use microtouch, you do not need an AVR programmer, because the bootloader is already flashed in microtouch! The bootloader is activated by pressing the “Reset / Boot” button when USB is connected. You can determine the activity of the bootloader by flashing the green LED "Boot". After that, the board will be defined as a COM port, and it will be possible to use avrdude for firmware. The programmer name is avr109, that is, for example, to check the bootloader you need to run avrdude -p m32u4 -P COM3 -c avr109

Soon, the bootloader will issue a timeout (after about 5 seconds). Since we do not use a USB / Serial converter, the firmware is very fast. You can flash the entire controller in less than 2 seconds!
The bootloader takes up the top 4 KB of FLASH, so keep in mind that you only have 28 KB instead of 32. We think this isn’t very scary, and 28 KB is not so small. If you need more free space, you can always use the ISP-connector and the AVR-programmer (which will erase the bootloader).
If you use Windows, you will need an inf file. Apple owners and Linuxoids do not need to worry about anything, because the device will be defined as / dev / ttyUSB * or / dev / cu * (you can check with dmesg ).
To exit the program, you need to click on the dark part of the screen, below the image on the screen.

The main screen shows the programs flashed in microtouch. Programs are selected by touching a finger to the desired circle.

Microtouch can be used to view images by converting images to im2 format (which is more convenient to draw on the screen). The converter can be found in the repository on github. Place the images in the root folder of the microSD card and insert the card into microtouch. After turning on the device, you will see icons for images. Click on a circle to view any. You can "drag" the image with your finger.
<
Icons for files on a USB flash drive sometimes do not appear after loading, if the card is 2GB or larger. If the image icons do not appear, start the HWTest application and make sure that everything is ok with the USB flash drive. After exiting HWTest, the icons should appear.
The Off application (never guess) turns off your device. The device will not turn off if connected to USB.

With this application, you can check the battery voltage, backlight, touchscreen, accelerometer and SD card. You can also change the brightness of the backlight.

Doomed is a simple three-dimensional engine. You can move around the map, touching the part of the screen in the direction you want to move.

This app is used to calibrate the touch screen. You only need to do this once for the life of the device: the calibration is stored permanently in EEPROM. Touch the centers of the circles with finger or stylus to set the calibration points.
This application is used to calibrate the touchscreen: you need to touch the centers of the circles with your finger or stylus. Calibration can be performed only once during the entire lifetime of the device: calibration data is stored directly in the EEPROM.

This application uses a three-axis accelerometer to move the ball around the screen, and also displays a "cardiogram" of the data being read. The ball moves when shaking the device.

A small cute program that demonstrates sprite animation of a packman (you can’t play a packman yet).

This program draws a three-dimensional icosahedron on the screen. The figure responds to the accelerometer, it can be rotated by shaking the device.

Another three-dimensional application.

Click on the squares, watch out for mines! One-to-one like Minesweeper, but no need to install Windows.
You can draw on the screen with your finger.
A single player game similar to Go. The game ends when all the tiles are painted in the same color.
If you want to develop programs for microtouch, then you need AVR-gcc.
Translator's note: today there is an official project site on sourceforge and an application for reading e-books in epub format. You can assemble the gadget yourself or purchase it in online stores.


Of course, one scheme and wishes of luck are clearly not enough. Therefore, the creator of microtouch (which we know by the code name " Rossum ") wrote an operating system and several demo applications , for example:
- Image viewer - you can insert a microSD with images, slide shows or animations, and they will be shown as “mini-programs”
- Calibrate - Touch Screen Calibration
- Doomed - a three-dimensional maze
- Accelerate - you need to save the ball in the center of the screen using the accelerometer
- Paint - finger painting without the ability to clear the screen
- Flip - reverse game
- Minesweeper - Minesweeper for which you do not need to install windows
- 3D Icosohedron - a three-dimensional icosahedron controlled by an accelerometer
- Pacman - demonstration of sprite animation
- Lattice - 3D grid demonstration
The project is the result of a collaboration between Rossum and Ladyada, developed in California and New York.
Hardware design

Microcontroller

Microtouch's brain is the Atmega32u4 in a TQFP package. The chip has built-in USB support and many contacts.
Li-polymer battery and charger


The board has a charger for 3.7 volt lithium-polymer batteries (MCP73812). The battery must be connected to the 2-pin JST-PH, remembering to check the polarity before connecting. The charger circuit is very simple, but it charges the battery normally. The charging current is approximately 250 mA, so do not turn it on to the hub without additional power. Most likely it will be charged from any computer. Unfortunately, there is no (for example, LED) notification that the battery is charged, but you can determine the status of the battery through the ADC of the microcontroller. You can change the charge current by changing the resistance of R17. Read the datasheet for MCP73812 to find the resistor for the desired charge current.
Power (3.3 Volts)

Battery (or USB) leads connect to the LP2985 3.3v LDO. This regulator is of very good quality, giving approximately 1% error and current up to 150 milliamps. In the microtouch circuit, 4 backlight LEDs consume the most current (up to 80 mA total). In addition, the microcontroller eats 10-20 mA, about 20 mA takes the TFT, and another 2 mA - a red LED. The accelerometer practically does not consume energy.
Led indicator

This LED is connected to PC7 and is used to indicate bootloader activity. You can use it as you like.
Quartz

The frequency of the crystal oscillator is 16 MHz. This is a small Atmel overclocking (at 3.3V it is better to use a frequency of 12 MHz); We test the microcircuits for functionality before sending. The reason for overclocking is that you can make a quick graphical interface. Near the quartz are two stabilizing capacitors.
Power button (or How does this thing turn on?)

Microtouch uses a trick that allows it to turn off when powered by battery. LDO has an “Enable” output that is shorted to common (that is, LDO is disabled by default). When the rectangular power button is pressed, LDO is turned on, which turns on the AVR. The first thing that the AVR does is to output “On” (it is connected to PF0) a high logic level. When the power button is released, this pin will keep the LDO operational. This means that if you are writing your code for Microtouch, first of all make sure that PF0 is in output mode and pass a high logic level to it.
Accordingly, to turn itself off, the controller can lower PF0 to a low level. The user will have to press the power button again to turn on the microtouch again. Do not do this when the device is powered by USB, because the bootloader may freeze. Pressing “reset” will bring the device out of the frozen state.
Reset button

A reset button is connected to the AVR reset pin. It can be used to start the bootloader. If you overwrite the bootloader, it will simply restart the device.
ISP Connector

AVR can be reflashed with any standard AVR programmer, avrdude, or something similar. During the firmware, do not forget to keep the power button pressed, or connect the device to miniUSB, or supply power (3.3 volts) from the programmer. Make sure the power is actually 3.3 volts. USBtinyISP, for example, gives 5 volts, and such a voltage can damage the screen.
Screen backlight

As the screen backlight, 4 white LEDs are used, connected in parallel. We use 22-68 Ohm resistors (68 in the image, the value may vary depending on the screen model) on each cathode. The cathodes are connected to pin PC6. You can change the backlight by changing the voltage at the output. When the backlight is off, nothing is visible on the screen.
microSD / transflash

MicroSD and microSDHC flash cards are supported.
Three axis accelerometer

The microtouch has an MMA7455 accelerometer for moving data. The accelerometer can detect movement and shaking. It can be set from + -2g (for high accuracy) to + -8g. No need to drop Microtouch to test the accelerometer! It’s better to use the Accelerate app for this.
USB

You can use the USB connector to download new firmware to microtouch. The bootloader takes up 4 KB of memory. The bootloader itself can be rewritten using the AVR ISP programmer.
You can also use the USB port to charge the battery. You can run Microtouch from USB, but since the charger is connected directly to LDO, the USB port will not be able to provide the necessary 100-150 mA. As a result, the core detects that the voltage is too low, and reduces the brightness of the backlight. That is why the screen is not as bright as when powered by a battery.
Loader
To use microtouch, you do not need an AVR programmer, because the bootloader is already flashed in microtouch! The bootloader is activated by pressing the “Reset / Boot” button when USB is connected. You can determine the activity of the bootloader by flashing the green LED "Boot". After that, the board will be defined as a COM port, and it will be possible to use avrdude for firmware. The programmer name is avr109, that is, for example, to check the bootloader you need to run avrdude -p m32u4 -P COM3 -c avr109

Soon, the bootloader will issue a timeout (after about 5 seconds). Since we do not use a USB / Serial converter, the firmware is very fast. You can flash the entire controller in less than 2 seconds!
The bootloader takes up the top 4 KB of FLASH, so keep in mind that you only have 28 KB instead of 32. We think this isn’t very scary, and 28 KB is not so small. If you need more free space, you can always use the ISP-connector and the AVR-programmer (which will erase the bootloader).
If you use Windows, you will need an inf file. Apple owners and Linuxoids do not need to worry about anything, because the device will be defined as / dev / ttyUSB * or / dev / cu * (you can check with dmesg ).
Programs!
To exit the program, you need to click on the dark part of the screen, below the image on the screen.
Main menu

The main screen shows the programs flashed in microtouch. Programs are selected by touching a finger to the desired circle.
Image viewer (built-in image viewer)

Microtouch can be used to view images by converting images to im2 format (which is more convenient to draw on the screen). The converter can be found in the repository on github. Place the images in the root folder of the microSD card and insert the card into microtouch. After turning on the device, you will see icons for images. Click on a circle to view any. You can "drag" the image with your finger.

Icons for files on a USB flash drive sometimes do not appear after loading, if the card is 2GB or larger. If the image icons do not appear, start the HWTest application and make sure that everything is ok with the USB flash drive. After exiting HWTest, the icons should appear.
Off
The Off application (never guess) turns off your device. The device will not turn off if connected to USB.
Hw test

With this application, you can check the battery voltage, backlight, touchscreen, accelerometer and SD card. You can also change the brightness of the backlight.
Doomed

Doomed is a simple three-dimensional engine. You can move around the map, touching the part of the screen in the direction you want to move.
Calibrate app

This app is used to calibrate the touch screen. You only need to do this once for the life of the device: the calibration is stored permanently in EEPROM. Touch the centers of the circles with finger or stylus to set the calibration points.
This application is used to calibrate the touchscreen: you need to touch the centers of the circles with your finger or stylus. Calibration can be performed only once during the entire lifetime of the device: calibration data is stored directly in the EEPROM.
Accelerate App

This application uses a three-axis accelerometer to move the ball around the screen, and also displays a "cardiogram" of the data being read. The ball moves when shaking the device.
Pacman app

A small cute program that demonstrates sprite animation of a packman (you can’t play a packman yet).
Icoshedron app

This program draws a three-dimensional icosahedron on the screen. The figure responds to the accelerometer, it can be rotated by shaking the device.
Lattice app

Another three-dimensional application.
Mines app

Click on the squares, watch out for mines! One-to-one like Minesweeper, but no need to install Windows.
Paint app
You can draw on the screen with your finger.
Flip app
A single player game similar to Go. The game ends when all the tiles are painted in the same color.
Download
- PCBs in EagleCAD format are located in the github repository of the Adafruit developer (distributed under conditions similar to Creative Commons Attrib / Share)
- The firmware code and image converter are located in the github repository of the Rossum developer (MIT license)
- Windows boot loader .inf file
If you want to develop programs for microtouch, then you need AVR-gcc.
Translator's note: today there is an official project site on sourceforge and an application for reading e-books in epub format. You can assemble the gadget yourself or purchase it in online stores.