Tuesday, 31 March 2009

Logging temperature

Displaying static pictures on an LCD is quite cool (see my previous post) but it doesn't get you very far, does it?
I always wanted to build my own temperature logger and graph it in a display, so it was now or never! I had a couple of I2C temperature sensors lying around and also a serial EEPROM, so I hooked them all together, and voila voila!!

Time for details now! Sorted from fun to less fun :-)

- The data scrolls one pixel every 5 minutes, the LCD is 128 pixels wide I can display the temperature for the last 10.6 hours.

- The flat part of the graph is during the night, as you can see the thermostat is doing a great job at keeping a constant temperature!

- The non-flat part is during the day the sun enters through the windows and heats up the place. There is a small spike and that is because for while the sun hits directly the sensor.

- For the clock, I used the fact that I can drive one of the AVR's timers using an external oscillator, I used a 32.768MHz crystal this number is exactly 128*256, so you just have to set the timer's prescaler to 128 and you'll get a 8bit timer overflowing once a second. Se the timer to generate an interrupt at that point and that's it. Look at the Atmel's Butterfly source code for reference.

- Drawing the line was quite tricky, because the LCDs' framebuffer is not linear at all and also because I wanted to write up to 8 pixels with the same memory access. It was tricky but I made it, I'll probably post the code in another post.

- The rest is simple stuff, the temperature sensor is a LM75A, and the serial EEPROM is a 128Kb one.. both of them are controlled using and I2C bus, so piece of cake!

And now the full monty:

More details on demand, Thanks for reading!

Sunday, 22 March 2009

GIMP Plugin to export fonts and bitmaps for ks0108 LCDs

I wanted to display some cool pictures in my ks0108, GIMP was perfect because it allows me to edit pictures and convert them into 1bpp pictures, the only part that was missing was to have a way to export the picture in a format that I could easily embed in my firmwares and that I could send quickly to the LCD.

So voila voila! here is the missing part, a very cool plug-in that does exactly that, this plug-in saves the data into a C source code header file, and arranges the data in a way that can be uploaded to the LCD quickly and with minimal code.

Details about installing it, and loading the data are embedded in the python plug-in file that you can get here.

And now the pictures!

The artwork for this one was ripped form Knight Lore

This picture was taken for the 8bit game The Abbey of Crime

And this is the whole shebang, just ripped the KONAMI logo from a MSX game

You can also use your bitmap as a font if you arrange letters in the following way :

Hopefully with this script we'll start seeing new cool bitmaps/fonts in projects, besides from the usual suspects we are used to see :-)

If you use it you are welcome to drop me a line, that will probably encourage me to write more free software!

The next step is to export the bitmap in binary format so I can store it in an serial EPROM (rather than using the chips flash) , but I guess thats all for now, enjoy!

I used M-A Loyer's exporter for NDS as a reference for mine, thanks!

Sunday, 8 March 2009

weekend project: reading 27256 eproms

One of my favourite hobbies is to open electronic devices to see what is inside, to hack it or to scavenge its circuits. For that I usually buy quite old devices since the new ones all use SMD and there is not much you can do with them.

Luckily in the city where I live there is a secondhand/flea market where you can buy all kind of stuff and I found a cool device (see the picture below) and when I opened it I discovered a bunch of 27256 EPROM's inside.

These EPROM's have a 15bit's address bus and a 8bit data bus. As the microcontroller I used an Atmega128 connected to my computer thought a serial port. The microcontroller sets the address in the bus using a couple of 74HC595 (8-bit serial-in, serial or parallel-out shift register), that way I only need 3 GPIO's to set the address I want to read from, for the data I just use the whole (ouch!) PORTA of the microcontroler.

It all worked pretty straight forward, the only problem I had is that by mistake I wired the data bus in the reverse order (so D0 was connected to D7, D1 to D6 and so on) but once I figured that out I dumped the EPROM again and got a great satisfacton when I read the strings stored in the EPROM :-))

Ok, so here come the pictures and a bit of the EPROM DUMP

0000 02 05 48 02 56 09 FF FF FF FF FF 02 07 83 FF FF ..H.V...........

0010 FF FF FF 02 6C 51 FF FF FF FF FF 32 FF FF FF FF ....lQ.....2....

0020 FF FF FF 02 45 18 FF FF FF FF FF 32 FF FF FF FF ....E......2....

0030 30 31 32 33 34 35 36 37 38 39 41 42 43 44 45 46 0123456789ABCDEF

0040 46 41 54 41 4C 20 43 52 4F 4D 20 45 52 52 4F 52 FATAL CROM ERROR

0050 46 41 54 41 4C 20 49 52 41 4D 20 45 52 52 4F 52 FATAL IRAM ERROR

0060 58 52 41 4D 20 45 52 52 20 7E 20 7E 5F 5F 5F 5F XRAM ERR ~ ~____

0070 46 49 52 4D 57 41 52 45 20 45 52 52 4F 52 20 20 FIRMWARE ERROR

0080 53 59 4E 54 41 58 20 46 49 4C 45 20 45 52 52 20 SYNTAX FILE ERR

0090 43 4F 4E 46 49 47 20 46 49 4C 45 20 45 52 52 20 CONFIG FILE ERR

00A0 54 52 41 4E 53 2E 20 46 49 4C 45 20 46 55 4C 4C TRANS. FILE FULL

00B0 54 52 41 4E 53 2E 20 50 41 43 4B 20 45 52 52 20 TRANS. PACK ERR

00C0 54 52 41 4E 53 2E 20 42 59 54 45 20 5A 45 52 4F TRANS. BYTE ZERO

00D0 2A 20 42 41 54 54 45 52 59 20 4C 4F 57 20 2A 20 * BATTERY LOW *

00E0 2A 2A 20 42 59 50 41 53 53 20 4F 4E 20 2A 2A 20 ** BYPASS ON **

00F0 20 44 41 54 45 29 20 44 44 2D 4D 4D 4D 2D 59 59 DATE) DD-MMM-YY

0100 20 54 49 4D 45 29 20 48 48 3A 4D 4D 20 20 58 4D TIME) HH:MM XM