Projects

This page contains some of my spare-time projects, not including countless of small development boards and experiments with various IO devices, memories etc.... Many of those devices are just brain exercises, not practical gadgets.
You can't find much schematics nor source codes here as this is not cookbook, but inspiration/overview page. I wish I could find time to make detailed overview of all my projects.
You can always send me an e-mail, if you really wish to get hard to read and messy source codes with no support or hard to read schematics. Those projects are generally not suitable for beginners. You have been warned.

-NP1-"Unusable computer 1" - emulator of virtual 16-bit machine, on dsPIC33FJ128GP802
-NP2-Small unusable computer, programmable in BASIC, PIC18F2620
-NP3-
Another one, programmable in Forth, PIC24FJ64GA102
-CP/M 1-Z80 emulator running CP/M with custom BIOS. First iteration, PIC32MX795F512H
-CP/M 2-The same as before, better keyboard, bigger display, PIC32MX795F512H
-CP/M 3-Mini CP/M machine
-Lua-Experiments with LUA running on PIC32MC795F512H
-Fprog-Simple 29F010 FLASH memory programmer, PIC18F4550
-IR PC RC-Remote control for PC, PIC18F2550
-Scut3-PIC18 handheld toolchain plus more, PIC24FJ64GA102
-Scut5-PIC18 toolchain, first "serious" hardware, PIC24FJ256GB106
-Piano-Touch piano, dsPIC33FJ128GP802
-GPS1-GPS logger with PIC18F25J10
-GPS2-Better GPS logger with PIC24FJ64GA002
-GPS3-Mini logger, without display, PIC18F1320
-GPS4-GPS mapper, first iteration. PIC24FJ64GA004
-GPS5-GPS mapper, second iteration. PIC32MX795F512H
-Voltlog-Simple voltage logger I built for LiIon cells characterization. PIC16F886
-GM-GM detector/counter. PIC16F688
-NT clock-Clock with Nixie tubes. MC68HC908QY2
-CAN board-Experiments with CAN and LIN bus. PIC18F2685
-GSM 1-GSM experiments, PIC24FJ64GA002
-ETH board-Ethernet universal IO board. PIC24HJ256GP206
-Minitemp-Small USB temperature meter with DS18B20 and PIC18F2550
-MP3 player-MP3 player with VS1001 and PIC18F2620. My own FAT16 routines
-Altimeter-Simple barometric altimeter, PIC18F252
-Lowtemp-Temperature meter with low current consumption (2uA average), PIC16F917



NP1
This is emulator of virtual 16-bit CPU. This CPU has no real counterpart, it is my own core.

Opcode Mnem. Op1 Op2 Op3 Words Flags Comment
0 mvi imm dst16   3   move immediate value to RAM
1 mov src16 dst16   3   move RAM to RAM
2 rol mem16     2 c,z rotate left RAM word
3 ror mem16     2 c,z rotate right RAM word
4 add opr16 mem16   3 c,z add two RAM words (with carry)
5 and opr16 mem16   3 c,z AND two RAM words (with carry)
6 ior opr16 mem16   3 c,z OR two RAM words (with carry)
7 xor opr16 mem16   3 c,z XOR two RAM words (with carry)
8 bts mem16 bit adr16 4   bit test, jump to address
9 jmp adr16     2   jump to address
10 jsr adr16     2   jump to subroutine
11 rts       1   return from subroutine
12 rti       1   return from interrupt
13 psh mem16     2   push RAM on stack
14 pop mem16     2   pop from stack
15 off mem16 mem16   3   set offset words

Instructions are fairly common. Interesting is last instruction - off. It declares offset to some instruction, like mov and others. Off instruction has two operands, pointing to RAM words, where is defined offset.
If location 0x900 = 0x0000, 0x902 = 0x0000
then instructions
off 0x0900, 0x0902
mov 0x0904, 0x0906
will cause value of word 0x0904 to move to 0x0906.
If 0x0900 changes to 0x0004, the same instruction
mov 0x0904, 0x0906
will cause value of word 0x0908 (0x0904 + 0x0004 from offset register 0x0900) to move to 0x0906. Using this mechanism is relatively easy to create indirect memory access, arrays, data copying etc. without dedicated addressing mode.

Memory map is very similar to hosting dsPIC33FJ128GP802 memory map.
memory map
0x000 here are
dragons
  (SFR)
0x800 RAM
(16kB)
0x47FF  
0x4800 unimple
mented
0x7FFF  
0x8000 user
FLASH
0xFFFF  

And there are special registers. In fact it is normal RAM location, but it has defined value after reset.

address loc defval
0x0800 A 0x0000
0x0802 B 0x0000
0x0804 C 0x0000
0x0806 F 0x0000
0x0808 PC 0x1100
0x080A SP 0x1000

There are also interrupts (external interrupt), but not fully implemented.
After reset, computer will read binary image from external serial EEPROM, load this into RAM and starts executing this program.
I wrote also simple cross assembler for this virtual CPU, in C#.

FAQ:
1,
Q:What is it good for?
A: It is good for nothing, just intellectual exercise. By the way, NP means "nepouzitelny pocitac", in Slovak language it means "unusable computer". This is good name for this one.
2,
Q: That instruction set is quite odd, don't you think?
A: Yes, I do.

If you can read Slovak language, more info is here
Photo on picasa.



NP2
 Another unusable computer. This one is based on BASIC-52 project, which begun at 80's in Intel. After Jan Waclawek ported it for modern x51 derivative, AT89C51RD/ED2, I decided to glue a small terminal with PIC18F, display (16x2 characters) and cellphone-like keyboard on it.
Its housing is terrible and internal design is even more messy - but after all it works. One can write and run programs in BASIC, access IO from those BASIC programs and... and thats all, what more do you want?
Photos on picasa.



NP3

Third unusable computer. Similar to NP2 in its basic concepts, but built around FlashForth from Mikael Nordman. Terminal uses with PIC24FJ64GA102, 98x64 graphical display and again, cellphone-like keyboard. Unlike NP2, this has no housing, so there is nothing to screw up.
You can see version with dsPIC30F3013 on those pictures. Later i swapped this PIC for PIC24F16KA101, with benefit of lower power consumption. Complete system is supplied with 2,5V, current consumption is cca 3mA. Yes, 8mW computer.
Photos on picasa.



CP/M 1

This is first iteration of my CP/M OS on virtual machine. After successful test of CP/M emulator with traditional serial terminal (PC) I decided to replace it with local keyboard and LCD 4x40 - biggest alphanumeric LCD I could find here (yes, there are graphic displays with better resolution, but those have quite high current consumption or has small pixels, good for graphics, but unsuitable for text). After all, even this display resolution (far from standard 80x25 characters) is not enough - that's why I bought graphical 240x128 pixels for CP/M 2 project.
Photos of CP/M1 picasa


CP/M 2
Second iteration is more usable. LCD 240x128 allows to print 16 rows by 60 characters. This LCD has dedicated driver PIC18F2620, emulating part of VT100 commands. Keyboard is electrically almost the same as for CP/M1.
I'm planning to put this into "laptop-like" housing. Current consumption is cca 130mA @ 4V, so LiIon cell is good power source candidate.
Link on my page and picasa album.


CP/M 3

Project in its very early stage.
I'm planning to make small (cca 24x32mm) CP/M computer, which can boot and run completely from its on-board resources, but without display or keyboard. Just few IO pins and serial line for communication. PCB is done by now, I just have to bring it to life.
Photos on picasa.



Lua

Askr's interesting project of implementing LUA into PIC32 brought me to idea of NP4, based on LUA language. For now, I have it running without dedicated terminal, but including one (as for NP2, NP3 or CP/M 2) is just a question of time.
For now it is running on the same board as CP/M 1.



Fprog

When I played with old CPUs (Z80, 8080, 6800), I needed some kind of permanent storage. Those days EPROM was good choice, nowadays FLASH is better one. Instead of buying programmer, I put together this one in few hours and it served for a long time, until I bought universal programmer. I wrote small C# loader for it.
This programmer programmed only first 64k of FLASH - it was enough for those 8-bit CPUs.
Photos on picasa



IR PC RC

Often I watch movies on my PC, but leaving comfortable sofa just to change volume or pause movie for a moment is very painful for lazy person as I am. That's why I put together this quick "hack" - PIC18F2550 acting like USB HID device, pretending to be USB keyboard and PIC16F88, receiving RC5 commands from IR remote control. Every IR message is sent by USART to USB PIC, which generates appropriate keystroke. Not ideal solution, but it was fast and it works great.
I programmed it to play together with keyboard shortcuts for BS Player and Winamp, plus some generic keys - like arrows, Enter, Tab, Alt-F4, space.
Photos on picasa



Scut3

This is small device, built around through-hole components, another unusable computer.
PIC24FJ64GA102 has only 64kB of FLASH and PIC18 toolchain occupies cca 40kB of it, so I add external SPI FLASH - this can hold 8 various program images, plus bootloader in PIC, which can boot from one of those images. It was inteded mainly for hosting my PIC18 toolchain, but there is also dsPIC30F3012 on board, programmed with FlashForth.
It works, but it's a bit awkward, so I decided to stop this project and use appropriate components next time (MCU with more FLASH memory).
Photos on picasa.



Scut5

... a result of Scut3 improvements.
This one has dedicated page.



Piano

Inspired by this page I decided to build something better, not depending on some OS or trial demo compiler version. Principle of operation is the same, but I built it around dsPIC33FJ128GP802, 40MIPS DSP. I got polyphony of 8 voices, with sampling rate 40kHz, 9-bit resolution of 78kHz PWM. Definitely better sound.
I have appropriate number of coins ready to be installed on wooden base... for a year. I have to find time to finish it.
Photos on picasa.



GPS1

This is my first GPS logger, allowing to show and log GPS position. It has few disadvantages, like small memory, relatively weak (for this task) PIC18 MCU, so I decided to move to another project, based on PIC24
Photos on picasa.



GPS2

More advanced version of GPS1. Allows also displaying distance and bearing to waypoint, suitable for geocaching, for example.
Photos on picasa.



GPS3

GPS minilogger. Unlike GPS1 and GPS2, it does no data compression, but rather it saves raw NMEA sentences. There is bigger (2MB) FLASH onboard, allowing to save few hours of continuous GPS log. Device was built to be as simple and small as possible (and practical), from hardware and software perspective. I use it quite a lot.
It looks rather bad - PCB and LiIon cell keep together thanks to amount of duct tape. On the other hand, it is quite durable, cheap and easy to repair.
Photos on picasa.



GPS4

This is my first attempt to make GPS with color graphic display and maps on SD card, showing actual position on map. I decided to stop this project as soon as I found out that PIC24 is not very suitable for this task (32bit MCU would be better), display could be bigger and map system have to be completely reworked. Old map system consisted of bitmaps with size cca 2000x200 pixels and database to find relation between zoom level, geographical location and map filename. It was a bit difficult to update maps, so I decided to use 256x256 pixel tilemap system from openstreetmap and freemap.
Photos on picasa.



GPS5

This is result of unsuccesful GPS4 project. I used PIC32MX795F523H - 512kB of FLASH and 128kB of internal RAM - and LCD320x240 are better than those at GPS4.
I added bluetooth module to cooperate with external bluetooth GPS module, USB connector for communicating and battery charging (not implemented yet, but there is a space on board for charger IC). It needs a bit of polishing to get into final state, but hardware changes will be relatively small.
Photos on picasa.



Voltlog

When I started to play with portable electronics, I was in a need of reliable and powerful batteries. LiIon are quite cheap and powerful those days, so it seems to be ideal for such as application. But capacity printed on cell is not often real, because of its age or simply because manufacturer is liar. In order to find out real capacity, I built this simple discharger with voltage comparator to remove load at low voltage and logger, enabling me to watch battery voltage during complete process. This allows me to calculate energy and capacity given through discharge cycle.
It is built around PIC16F886, programmed in assembler - just because of fun during programming. EEPROM is Mircrowire type - the same reason. IIC and SPI memories protocol is boring to program again and again, so I had a bit of change here.
By the way, cheap batteries, sold as cellphone battery replacement, has often one half or even one third of declared capacity.

Photo on picasa.
If you can read Slovak language, take a look here.


GM

This one is small Russian Geiger-Mueller detector (very cheap on eBay) with appropriate electronics: 400V generator, impulse amplifier and counter built with PIC16F688. Sources are written in assembler... just because of fun. It shows only absolute number of impulses since power-on, time from power on, one minute impulse average and battery voltage. Everything is powered by 9V battery, current consumption is cca 0,8mA.
Photos on picasa.



NT clock

Small nixie tube clock, build around MC68HC908QY2 and SPI RTC DS1305. SPI IO MCP23S017 expander drives four 74141 drivers/decoders. 170V for nixies is generated by UC3842 step-up. Power supply is 12V/1A.
Photos on picasa.



CAN board

Board for experiments with CAN interface and LIN interface. There was sensor (button) on LIN slave device, and one CAN node polled for state of this button through another CAN node, which is also LIN master. It was intended to serve as basis for small automation system in my workplace, but I found it is rather cumbersome way to generate confusion and problems (as most of similar automation systems are), so I let it be. After all, playing with CAN and LIN was nice exercise.
Photo on picasa.



GSM 1

I began experimenting with GSM modules, namely SIM300 from Simcom. After a bit of struggling I made simple GSM mobile phone. Well, it wasn't very mobile, as it had to be supplied with 12V power supply, but now I'm working on smaller version of it.
Unfortunately, it was short living project, with no photos. It was terminal from NP3, with adjusted firmware,  protoboard with SIM300 and its power supply plus mess of wires, which fell off from a time to time. So I decided to not continue on this project and start new GSM project. PCB for new GSM is done now, so in short time there will be GSM2 project.
Photos of GSM2 on picasa.



ETH board

I built this board after playing with ENC28J60 on universal protoboard.
There is ENC28J60, PIC24HJ256GP206, RS232 and RS485 interface, plus lots of IO pins, which could be connected to another PCB, stacked on ETH board. On first revision I made a few mistakes, corrected on next one.
Photos on picasa.



Minitemp

Small temperature meter, based on PIC18F2550 with DS18B20. Device enumerates as HID device, small PC software belongs to it, and allows to measure and save temperature into file.
Photos on picasa.



MP3 player

Old project with PIC18F2620, VS1001 and SD card, forming MP3 player. Minimized user interface consists of two buttons and one bicolor LED. I wrote my own FAT16 routines for this project.
Photos on picasa.



Altimeter

One of my oldest MCU projects, built around PIC18F252, 12-bit ADC measuring voltage from MPX4115, DS1624 measuring temperature. Those variables are used for altitude calculation. Useful device for tourism.
Photos on picasa.


Lowtemp

This temperature meter was built with one goal - current consumption as low as possible. After a few iterations I got to average consumption cca. 2-3 microamps @ 3V. It is built around PIC16F917, MCP9801 and 3,5 digit LCD glass.
Photos on picasa.


Updated 11.8.2011
Back to topics