Tuesday, November 11, 2008

Call Filter

I often woke up early, around eight AM in the morning. I have a phone in my bedroom, but the calls in the morning never seem to be for me. So to make an end to these wake up calls I programmed a PIC16F628A and combined it with a DTMF decoder to give me my rest during Sunday and Saturday mornings. The telephone number of the person calling is read and compared with a couple of telephone numbers stored in the PIC, does the number equal one of the stored numbers than the name of the person calling is displayed on the LCD Display, and the phone will ring. If the number does not match one of the known numbers then my phone will not ring as it will be disconnected using a relay.

Movie of the Call Filter in action:


PIC Generated PAL Video

I wanted to know if it was possible to reach a reasonable resolution using a PIC. For this project I used a PIC16F648A which has a capacity of 8 KB flash program memory. I chose for a PIC with such a big capacity because I wanted to use 4KB of the chip for a nice lookup table which could hold a full ASCII character set. In this 4KB block it can store 256 8×8 characters. The text shown at the screen is programmed in the PIC’s EEPROM as ASCII.

This project is not yet finished, that is why you see the same text again at the bottom of the screen.
(The EEPROM is 256 bytes so it can hold 256 characters, but the amount of characters that can be shown at one screen is much higher)

Okay so these black parts in the screen are caused by interference between the frame rates of the camera and the television. In reality the characters are shown nice and clear.

Meaning of the text shown:
“This project is not completely finished, but the PIC reads this text out of the EEPROM as ASCII, then it looks up the correct characters. There is enough space for a complete ASCII chart with characters of eight x eight”


PIC Based Digital Clock

A little time ago my clock died on me, I thought well why shouldn’t I just build one myself? So that is what I did. This clock is based on two PIC16F628 chips, I know that it could easily be done with a smaller PIC but this was the only type I had lying around when I built it. One of the PICs does nothing more than creating a 10Hz clock. The other PIC drives the 15 7 segment displays (which ironically have 8 segments including the dot) and the counting. To save some IO lines the almost 128 LEDs are arranged in a matrix, and to save even more these lines are controlled by three 74HC595 shift registers. This way it is possible to control all segments with only three IO lines.

The clock does take care of the different lengths of the months and leap years, just when I thought I had everything….. daylight saving…… well maybe something i’ll fix later on then…..


Friday, September 26, 2008

Super Mario On An LPC2148 Rules

I decided to put some more effort in my Super Mario project. I started with stripping my code leaving only the background. I wanted to see for how far I could make a real playable version of Super Mario on my LPC2148 ARM board.
After making some minor changes to the code I had created a scrollable background without using extra CPU time. After some other changes I enlarged the frame buffer to have a part of it outside the displayed area. In this off screen part of the buffer the level is built by reading which blocks to use from a level file.

To create the feeling of the real Super Mario I connected an ordinary NES controller to control the game. At that point it was only possible to use the controller to scroll through the level, but at least it was something.

The only thing left to do was to program the game play and the possibility to show sprites back into the software. Please check the video below to see the result:


Joost Thijssen =)

Friday, August 22, 2008

GPS Robot

TODO: Translate This Text…….
Sorry guys

Voor de afsluiting van het 3e jaar hebben we met een projectgroep van vijf man software geschreven voor een robot die in staat is om met GPS coordinaten te werken.
In eerste instantie wordt de robot onder de arm meegenomen en op verschillende plaatsen neergezet. Op deze plaatsen wordt door de gebruiker op een knop gedrukt zodat de robot weet dat het betreffende GPS coordinaat opgeslagen moet worden. Nadat vier verschillende coordinaten zijn ingevoerd kan de robot worden gestart en moet deze door hoekberekeningen uit te voeren zijn ingestelde punten terug kunnen vinden.
Doordat GPS bepaling niet zeer nauwkeurig is, is het vrij lastig om de robot in een rechte lijn naar zijn punt te laten rijden. Daarnaast zal het punt dat opgeslagen wordt afwijken van de werkelijke plek en het punt dat bij het terugvinden van het coordinaat wordt ontvangen nogmaals afwijken. De totale afwijking kan hierdoor al snel op meerdere meters liggen.
De robot moet in staat zijn om theoretisch het punt tot op een meter nauwkeurig te vinden, dat wil zeggen dat de robot het punt als gevonden mag beschouwen als het ontvangen GPS coordinaat op minder dan een meter van zijn opgeslagen coordinaat ligt. Om dit te kunnen bewijzen moeten de opgeslagen en gevonden coordinaten worden gelogd op een SD kaart. Hierbij moet aan een standaard worden voldaan, in ons geval FAT16, zodat het mogelijk is om de logfile later op de PC uit te lezen met bijvoorbeeld notepad.

De gebruikte processor is een ARM7 (LPC2148) en als basis voor de software wordt micro/OS gebruikt. Het gebruik van micro/os was in dit geval geen voordeel, volgensmij houden Electronic Engineers sowieso niet van het idee dat er een OS op hun CPU loopt. Alle drivers voor de verschillende peripherals moesten zelf worden geschreven. Hieronder de SPI aansturing van de SD kaart en I2C voor de aansturing van het motorbordje dat bij het platformpje hoort.

In de video is te zien dat de GPS dongle boven de robot aan een vishengel bungelt, dit is omdat in eerste instantie op een minder open plek werd getest en het metalen platform een GPS fix verhinderde.

Het project verliep erg soepel en er was redelijk wat tijd over, vandaar dat ik nog de tijd heb kunnen nemen om een tweede versie van de software te schrijven die geen gebruik maakt van micro/OS. Deze is niet gebruikt aangezien het een eis was om micro/OS te gebruiken. Daarnaast is de robot uitgebreid met een tweede LPC2148 bord die aan de hand van de waarde op een aantal selectielijnen verschillende PCM WAV files kan afspelen van een SD kaart. Bij het accepteren van coordinaten wordt een kort geluidsfragment afgespeeld en tijdens het terugzoeken van de coordinaten worden verschillende tracks afgespeeld om het kijken net even iets leuker te maken.

Dit project is gerealiseerd door:

Joost Thijssen
René de Jong
Hans van Wieren
Gert-Jan Lekkerkerker
Steven van der Vlugt

Kijk gerust even mee met de uiteindelijke demonstratie, opmerkingen hoor ik graag :)


Super Mario Look a Like on an LPC2148 ARM Processor

This is one of my most favourite projects that I have ever done for my study. For the course Real Time Systems everyone had to write software for an LPC2148 ARM7 which was able to generate a VGA signal. This project had to be realized individually. One of the requirements was a minimum resolution of 15×10 pixels and the image shown should be read out of RAM and at least changeable (by buttons or the running software itself). It should be realized without usage of external hardware except for some resistors to scale the output signals.
We had to use the ARM development board made by a teacher at our school (Hogeschool Utrecht), it is provided with an LPC2148 and some peripherals which could be usable for other projects. An external add-on board provided the main board with nothing more than a VGA connector connected to the ARM’s IO lines with some resistors in between. Unfortunately the connector was made using only one IO line per colour (RGB) so this fixes the colour depth to only eight different colours.

Since it was Easter and I had too much time on my hands I thought it would be cool to take this project to the next level. The timing generated is equal to the timing used by a resolution of 640×480 but the real resolution is only 128×96. As the vertical resolution is fixed this still means that it needs to print 480 lines per frame. To create square pixels it just prints each line four times.
If you do some calculations you will see that there is only little time left to calculate things, as the processor will be fully used while printing VGA data.

To make sure that the timing of the VGA signal is as good as possible, the core of the software runs on a Fast Timer Interrupt which occurs at every start of a scan line. The program code will jump to some ASM code which generates the correct VGA signals. As this part of the code prints the RAM video buffer the only thing left is the code which changes the data stored in the RAM video buffer.
A gain a little bit more time I decided to make some extra scan lines at the top and bottom of the screen just black. In this time a C routine has the time to do whatever it wants to do with the video buffer. As soon as the ASM routine has displayed the last scan line it sets a flag to inform the C routine that it can change things in the video buffer without accidently showing something half changed on the screen. The C routine is capable of removing sprites from the background and drawing new sprites easily within its time slice. At this moment it will never use more than half of the available CPU time in a worst case scenario.

Just to make it even cooler I used the PWM capabilities of the ARM processor to play the Super Mario tune on a little speaker. You can see the result of this project in the video below, if you have any questions or remarks feel free to contact me or leave a comment.

Joost =)


Projecten

I thought it would be nice to have a place where I can show my projects to other people. That’s why I have this blog. It is my intention to give a little bit of explanation with each project. Just something technical about its construction and a video or some photos to show what I am talking about.

So from now on everything should be interesting :)

Het leek me leuk om een plek te hebben waar ik mijn projectjes aan andere mensen kon laten zien. Vandaar deze blog. Het is de bedoeling om van ieder projectje een kleine uitleg te geven over de technische werking en een filmpje of foto’s voor het idee.

Vanaf deze post zou het dus allemaal interessant moeten worden :)

Admin area