Tuesday, December 28, 2010

"RS-232 Testboard" - more software

Just finished some libraries and tests programs for the "RS-232 Testboard" . You can download the package here: test-software.zip
I wrote a low level UART library, a high level library, and two example programs, showing the usage of the high level library (and as a bonus they have some nice effects).
All code was tested with Linux - but it should work with DOS too. If you want to compile it under Linux, you will need the ncurses developer library for the second example program.
Hm... perhaps i will upload some videos soon.

UART toy - additional comments...

I forgot to mention, that the Linux program must be executed as root. Otherwise it will not work, because it needs low level access to the serial port.
And the program must be compiled with optimization turned on.

The correct preprocessor command for GCC under Linux is "__linux__" - with two underscores and in small letters.

All commands in the instruction set are stated as ASCII characters. The return values and the parameters are in hex.


If someone got the circuit to work with Windows XP, please inform me. ;)

Monday, December 27, 2010

UART toy - part 4

And here is a list with the instruction set plus a short list of error codes for the AVR part:

http://sites.google.com/site/species0x2118/commands.pdf?attredirects=0&d=1

Enjoy. ^.^

UART toy - part 3

And another part (not the last one) of my UART series.
Here is a piece of code for the PC to establish a connection to the RS232 testboard and to communicate with it..
http://sites.google.com/site/species0x2118/testboard.zip

It is just an example how to interface with the board and not a complete library. The example application sets the outputs, reads in the inputs, reads the analog input and calculates the voltage on that pin. Everything with hardware handshake.
But you need the right cable for the handshake. Otherwise change the "true" in the uartSend commands to "false" and delete the handshake activation.

The software is tested under DOS with TurboC and under Ubuntu Linux with GCC. The source compiles with Open Watcom too - but the Watcom binary is not tested under DOS yet.
I changed the compiler preprocessor macros for the recognition of operating systems and compilers several times - but did not test every combination with every operatin system and every compiler. Perhaps you need to figure out the correct setup for your system (or just delete the stuff you do not need).

It took me several hours to figure out, that linux needs an activated FIFO control register. Otherwise the data transmission will fail in 99% of the cases.

Sunday, December 26, 2010

UART toy - part 2

Here is the code for the AVR as well as some pictures.
The C code: RS232_Testboard.zip
The code is public domain.
I am using Peter Fleury's AVR UART library for this project.

The first picture shows a test application, written on an 80286 with Borland TurboC that communicates with the RS232 testboard:
 The second picture shows the circuit itself:

New self made toy for UART programming

I have had very few time over the last weeks, so all hobby projects were paused in this time.
But now i have some spare time again - thx to Xmas and holidays!

The current theme in the technical engineering school i visit is "UART register programming". Sounds great, right? Just good enough for an nerd like me.
Sadly we only "program" the UART on paper... sounds sick - right? I was very unsatisfied with this fact and so i designed a small circuit arround an AVR. Now i am able to test the UART programming on the PC side. I learned much by this project.

The features of the board:
  • Serial communication using RS232, 9600 baud, 8 data bits, no parity, 1 stop bit.
  • 5 digital outputs (connected to LEDs)
  • 6 digital inputs
  • 1 analog input (8 bit ADC, Umax = 2,56 V)
  • 10 build in commands
  • hardware handshake can be activated
  • 4 free ports on the AVR

First the circuit diagram:

Monday, November 8, 2010

Game

The development of the level generator is almost finished. I have uploaded some screenhots of the generated levels. After programming this small demonstration- and test-application (the first three pictures) i made a very versatile class out of it and hacked it into my existing game. The game was heavily optimized too. There is only one bug left in the level generator. And after that i will add some functions for adding doors, treasures, monsters and so on. On the last screenshot you can see how the generated level looks like in the game. Now some usefull links for building your own random maps:
Enjoy! ^^




Tuesday, November 2, 2010

My game...

Because i had some free time last week, i started a small game project.
The game itself will be a mixture of "Castle of the winds" and "Diablo".
A project of my dreams. ;P
Round based Hack and slay, with tons of monsters, randomly generated maps, lots of weapons and armory...

Basic movement works, collision detection works, tile loading on two layers works, very basic map generation works.
Next on the list: a random map generator.
After that: interface tuning, adding monsters, adding weapons/armory/magic, adding sound ...

Monday, October 18, 2010

New software

Last weekend i wrote a small application for calculating truth tables based on boolean logic in C++. (/me was bored)
The software is inspired by Forth (the programming language) because it makes use of an stack and the reverse Polish notation.

The quickly written readme is currently available in German only.

This is an example for an XNOR with three inputs:
Formula:
a !not b !not c !not And And a b c And And Or a b !not c !not Or Or And
Or the simplified (optimized) version:
a !not b !not c
!not And And
a b c And And Or

Calculated truth table:
a b c Z
-------
0 0 0 1
1 0 0 0
0 1 0 0
1 1 0 0
0 0 1 0
1 0 1 0
0 1 1 0
1 1 1 1

Download:
Bool_solver.zip

Sunday, September 26, 2010

Some C helper routines...

I wrote a small application for counting the number of lines (of code) in *.c files today.
As a side effect i have now some handy functions for different applications.
Luckily i had the passion to write them.


Lets take a look at the functions:
void findFiles( char *, void (char *, char *) );
Finds all files in a given folder + subfolders and calls a user defined callback function.

const char *getFileType( char * );
Returns the file extension of a given file.

const char *right( char *, int );
Returns 'i'  chars from the right side of an string (same function as the command 'right' in VBS).

Works with PellesC 6.00.4.
I used some non standard C functions in the code. So it will not work with every compiler without modifications.

Here is the library: utils.zip


(God damn...! The layout on blogger.com is so crapy)

Tuesday, July 13, 2010

Latest work...

... currently i am working on a capacitive pipe brake or water detector.
 We had too many pipe breaks in the cellar.

Ok - in fact it is almost finished, i only lost a bit of my passion.

The circuit needs very few power (7µA @5V) and has a low part count. It could run several years with two AA batteries.
After endless frustrating hours coding an debugging with WinAVR and AVR Studio in the past, i gave mikroPascal a try in this project. And so far it works great.

Gameport to PS/2 converter - the build

Some weeks ago i soldered my gameport 2 PS/2 converter on a breadboard.
Oh yeah - i am beginning to hate breadboards...
It took more time than thought, but i finished it and the circuit worked. At least with my trusty old 80286 computer. With my new one it did not - the circuit was blocking my keyboard as soon as i pressed a button on the gamepad. So it is only a 50% success.
Works on my old computer, but not on my new one.
With an logic analyzer it would be a piece of cake to make it work...

I modified the plan a bit. You should keep in mind that the connection to the connector pins on the male and the female ps/2 connector must to be mirrored.

For the female ps/2 connector i cannibalised an old industry pc motherboard.
For the male part i stripped away the cable from an old keyboard. It is good to have a lot of trash at home. ; )
The gameport connector was bought.

Sunday, May 30, 2010

Processor artwork

Because i had a lot of processors and microcontrollers laying around, i made some "artwork" out of the stuff.
I bought a piece of ESD foam and sticked and glued all the stuff onto it.

Partlist:

Microprocessors:
  • Harris 80C286, 16 MHz
  • Cyrix 80387 math. co-processor clone, 33 MHz
  • Intel 80386DX, 33 MHz
  • Intel Pentium 1, 166 MHz
  • Cyrix Media GXm, 266 MHz
  • AMD K6-III, 400 MHz
  • AMD K6 2, 500 MHz
 Microcontrollers:
  • NEC 8085AHC
  • Siemens 80C537, 16 MHz
  • Atmel Atmega 8, 16 MHz
The two silver pieces in the middle of the foam are hard disk magnets, holding the foam on the magnet board.
An AMD 600 MHz Athlon slot a was to heavy to be glued on the foam. ;)

HDD storage tower made out of Meccano like parts

The idea was not new, but a few days ago i had the time and passion to make the dream come true.
There are five PATA hard disks mounted in the construction. The construction is quite stable and looks pretty.
I am sure: Gustave Eiffel would like it.
The reason for this construction was the bad hard disk alignment in this chieftech big tower. For SATA it is ok, but for PATA disks the slots are not very well suited.

Unfortunately the system disk of the server died while i was trying to figure out the correct PATA cable and connector assignment. (I had to reconnect the disk exactly as they were connected before the modification)
The system disk was not mounted in the tower - so it was some kind of natural selection not my own stupidy. ;)
Watch the video for the cool sound the disk makes...





video


p.s.: i found a guy who made a fan holder out of meccano: http://img.techpowerup.org/070507/2.jpg.

Temperature sensor disassembled



Some days ago i disassembled an RF temperature sensor used for a weather station.
It sends on 433 MHz.
Every 90 seconds the sensor is sending the actual temperature to the station(s).













Powered by two AAA batteries.
The chassis is sealed.
















The electronic circuit is rather small.
There are two PCBs. On for the RF part i guess with a big coil.
The other PCB contains the controller. It is covered by a black glue.
There is a contact on the PCB for the switch in the chassis for choosing the channel, marked with "TX" (by pressing it, the sensor is sending the temperature immediately).
The other contact is not brought out to the chassis. It is for switching between °C and °F.










This it the other side of the PCBs. You can see the red LED, that will blink every time the temperature was measured and send.
The contacts above the LED are looking interesting. Perhaps they were used for programing or testing the circuit?



And of course the sensor worked again after i reassemled it. ;)

Saturday, May 15, 2010

Finally!

I was able to get my old Hewlett Packard photosmart 1115 to work - with Windows Vista.
It took me 8 hours to plan and setup an external print server with linux and cups.
Finding the right operating system was quite a challenge.

But now the s*** works!
In the end i installed Debian Linux 5.
And i'm still a bit confused why Vista is so stubborn when it comes to printer support. (And HP in supporting old printers with drivers for new operating systems)
With my old XP i have no problems - no matter how i connect the printer to the computer - the printer just works.
The opposite with Vista - no matter how i tried getting it to work - it was resisting my efforts... till today.
But now: the resistance is futile! XD

Saturday, April 24, 2010

Thermometer version 5

I added backlight functionality to my thermometer.
A menu system was added too (as well as an annoying bug...).

I noticed that the button response is getting worse with time and the number of button clicks. Perhaps they are just to cheap? It is not a software fault.
The possibility to calibrate the clock for higher accuracy is still missing.

Gameport to PS/2 converter




Finally! My gameport project is finished!
With this little circuit it is possible to emulate a ps/2 keyboard with your gamepad.
I designed the circuit for a game that could not be played with that gamepad. But it worked well with a keyboard - so this evil mad idea was born. ;)
I used my old repaired gravis gamepad (repair report) for that project. Other gamepads could be wired internal in a different way.
The circuit is designed for digital gamepads only - no analog sticks or joysticks are supported (yet)!
But such a functionality could be implemented too. Because i used an old ATMEGA8, there are a lot of free pins for further experiments and hacks.
The buttons are "hard wired" in the code to keys. I used the ALT, SPACE, ENTER and CNTRL keys for the buttons. A function to define new key bindings without hacking them into the code and reporogram the controller could be implemented - but i was to lazy to write it. ^.^

Another impressive project that shows how easy and yet powerfull a µC circuit can be.
THX to the KISS guidelines.

The circuit in the red box does all the magic.












Feel free to use or improve this circuit.


The code can be found here:
http://sites.google.com/site/species0x2118/hive
http://sites.google.com/site/species0x2118/hive/gamepad.c?attredirects=0&d=1 (direct link)
I changed the fuses to run the controller with 8 MHz to have enough speed reserves. But a lower frequency could work as well.

As a goody i made a video of the gameplay with the gamepad connected to the converter:


Wednesday, April 21, 2010

Gamepad fixed


Last week i repaired my old Gravis gamepad. It had a broken cable. To fix it, i bought a joystick extension cable as replacement. Because the new cable was a bit thicker, i had to modify the casing of the gamepad. The modifications are not visible from the outside.


Monday, April 5, 2010

Watching the truck in action

video

Some new stuff

Today i have a bunch of new stuff. First of all: i made a six channel logic analyzer. The hardware was designed in about five minutes. The software in perhaps six minutes...

Here is the code:
#include <avr/io.h>
#include
<avr/interrupt.h>
#include "uart.h"

#ifndef F_CPU
#define F_CPU 11059200
#endif

#define UART_BAUD_RATE     115200

int main(void)
{
    uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
    sei();
    uart_puts("Starting low cost logic analyzer.\n");
   
    while (1)
    {
        uart_putc( PINB + '0' );
        uart_putc( '\r' );
    }
 }
You need the UART library from Peter Fleury (http://jump.to/fleury).
Unfortunatly i have no software for the data analysis. I saved the data with HTERM as text file so far.

Next project was the modification of my good old LEGO Technic truck.
He needs a huge amount of AA batteries - more than i had. But i wanted to make it work

And it worked. With my old self made power supply it was a joy to play with the truck. ; )


























And finally if finished the case for my thermometer. I found some transparent plasic in the cellar. Now only a calibration function for the clock is left.

Sunday, March 28, 2010

brightness switch

Here is a small project from my pre-µC era.
Back in those old glorious days i throw a bunch of parts together to be able to switch devices on or off depending on the brightness in a room.

Have phun...

Sunday, March 21, 2010

Thermometer - again

That's the proof, that the thermometer is able to display negative temperatures. ; )

Freeware tool: removing Canon DPP receipts from CR2 files


Because i am not an electronic geek only, but an photography geek as well, i spend much time with those hobby.

Today i finished a small hack for the photo geeks out there.
I am using a Canon DSLR and Canons DPP (digital photo professional) software for RAW processing and i was annoyed of the fact, that this program stores the RAW parameter in the original CR2 files.

Sure it is possible to remove those - so called - "receipts" from the RAWs, but this function is hard to find.
That's why i created a little java program, that can remove the receipts.
Just drag&drop the files you want to convert, into the program and hit the "remove receipt" button.
In the options dialog you can adjust the backup strategy and turn on the "AI stripping".

When "AI stripping" is on, the RAW configuration that is stored in the CR2 file will be searched directly, instead of searching for the adress of this section in the header.
This option could help, if you use an untested camera model.

The software was successfully tested with RAWs of Canons 350D and 20D and DPP 3.8.0 (german version) on windows xp.
The program should run on all operating systems with at least JRE version 5.


Use the software at your own risc risk. You are allowed to use it free of charge.

http://sites.google.com/site/species0x2118/hive/canondpp1269196060.zip
or:
http://www.filedump.net/dumped/canondpp1269196060.zip

Wednesday, March 17, 2010

Sorry

Since a few days or better weeks i have not much time and passion to post new stuff.
There are tons of hand drawn drawings on my table, a lot of unpretty but interesting source code somewhere on my HD and a lot of new ideas in my head... but the next project will be the fix of the power supply.
Either it will work, or i will trash it...
After that i will tidy up my workbench and after that... we will see.

Yesterday i had the idea to build an SPI sniffer to sniff the Canon EF protocol.
There seem to be no free info about it on the net...
A basic software for the µC part is almost finished.

Monday, March 1, 2010

Repairing...

Currently (better: since a few weeks, because i have no time and passion) i'm repairing a 24V DC power supply.
It can deliver around 24 amps - so... it could be usefull.


One error was found quickly: the pcb was burned and a diode was defect.
The defect pcb was even giving smoke signals after powering up the device.
And somewhere on the case was a bit of... voltage. I got almost electrocuted, after i touched the metal chassis.
Unfortunatly the diode was not a common type, but i got two pieces for a lot of money at a electronics dealer in the next bigger city.
But the power supply didn't worked anyway.
After turning the power supply on, the fuse in the fuse block was shutting down the power for my room... yeah. An electrical bolt flashing over the diode might have been the reason...

After disassembling the power supply even further i've found another error: an 300 watt MOSFET was dead. A wonderfull 0 ohm bridge.
The damn think cost ~10 €.
At least it is not as rare as the diode.
Hopefully i can reassemble the device again after fixing it. : (

Saturday, February 27, 2010

Code for the thermometer

I have just uploaded it to the crappy rapidshare.
http://rapidshare.com/files/356755556/Thermometer4_-_LCD.zip.html
MD5: 116890802238A5B89919CDB1B1972BD5

"Your file has been saved and can now be downloaded 10 times. It will be deleted after 60 days without download. If you would like to enable more people to download your file, please transfer it to a free Collector's Account or a Premium Account."

 And the mirror on google:
http://sites.google.com/site/species0x2118/hive/Thermometer4_-_LCD.zip?attredirects=0&d=1

Two small circuits

The first diagram shows how to interface an µC with an 7 segment display through an MC14513B. This little IC is an binary to BCD decoder and driver, that simplifies the interaction between digital circuits and 7 segment displays. Sure - it is a waste of parts and money, because the Atmega could deal with such a display without such an driver, but it was one of my first µC handicraft works.
Interestingly the driver IC was almost as expensive as the µC itself. ^.^°












The second diagram shows a voltage doubler circuit with AC input and 5V DC output.
I own an crosstrainer that need to be connected via a wall power supply to power the electronics (eddy current brake, LCD display, board computer, pulse measurement, etc).
I found it somehow annoying, that i was driving the piece of sports equipment with muscle power, "wasting" several hundred watts of power to get fit and loose weight and nevertheless needed to power the build in electronics with an external power source...
I wanted to use an old bicycle dynamo.
Unfortunately i found no way to mount the bike dynamo on the cross trainer. So i never used the circuit outside of my workbench.

Some interesting links:
http://en.wikipedia.org/wiki/Voltage_multiplier
http://www.coolcircuit.com/circuit/voltage/

Thursday, February 25, 2010

Additional adaptors for the ISP


Because i'm lazy dog, i made some adapters for my self made ISP to save the in-circuit programming connector. This would save some wires, parts, space on the board and a lot of time.
Now - with those adapters - i only need to connect the right adapter to the ISP and mount the adapter onto the µC.
Programming the µC is done as usually.

The only drawback is, when the adapter is mounted on top of an µC, it is not very stable. So better don't touch the whole thing while flashing the controller.

I made one adapter for the Atmega8 (in the background) and one for the Attiny84 (in the foreground).

The big one for the Atmega8 looks a bit strange, because i had to add another DIL socket to the existing one who had to unflexible pins.
My collection of DIL sockets is very limited.
It is better to use the cheap low quality DIL sockets, because their pins can bend well.
The more expensive ones have rigid pins, so they can not be bend over the µC pins.

Since i made the adapters, i have never soldered an ISP connector into an circuit again.
And because i don't want to take the credits for this invention: i have seen such an adapter in the internet, before i made mine. Thanks to you stranger for this fabulous handiwork! ^.^

Atmel ISP

Today i want to show you my ISP adapter for Atmega and Attiny µControllers from Atmel.
I found a circuit diagram in the internet, but unfortunately it was using an 74HC244 but i had only 74HC245 laying around.
That's why i redesigned the programmer a bit, to make it work with the slightly different 245.

The adapter is compatible with PonyProg2000 and AVRDude.

Now some pictures and the final circuit diagram:






























































PonyProg2000: http://www.lancos.com/prog.html
AVRDude: http://www.nongnu.org/avrdude/
A GUI for AVRDude: http://avr8-burn-o-mat.aaabbb.de (german)

Tuesday, February 23, 2010

Clock - some hints and thoughts

I have reprogrammed the clock-thermometer the first time after soldering it to the breadboard.

In the circuit diagram you can throw away jmp3 and jmp4 and replace them with a common jumper on the mass of D2 and R7.

Because my wall power supply not only outputs 9 V DC but also ~13 V AC, i decided to power the circuit with rechargeable batteries (4*1,2 V).

I thought it could help to change the following line:
degree = (degree * VREF) >> ADC_BITS;
to:
degree = ((degree * 1024) + (degree * 64) + (degree * 8) + (degree * 4)) >> ADC_BITS;

Where ADC_BITS is defined as 10 and VREF as 1100 (mV).
Indeed the code size shrinked from 3132 bytes to 3060 bytes, but the temperature was calculated wrong. The thermometer displayed a negative temperature, although my room was warm.

When i changed the code to:
degree = ((degree * 1024L) + (degree * 64L) + (degree * 8L) + (degree * 4L)) >> ADC_BITS;

The filesize was 3132 bytes again.

As you can see: the AVR GCC port isn't as stupid as you (or me) think. ;)

Happy soldering!

Monday, February 22, 2010

Clock-Thermometer with Attiny and LM35

Today i want to present you my last project i've made.
It's a more modern version of my first big µC project: a thermometer. (yeah!)
I finished it last sunday - at least the most parts of the project.

My first version i made months ago, was equiped with an Atmega8, four multiplexed 7 segment displays, "software" based USB and a batterie backup if no USB connection was in the near.
So far so good.

The negative points were:
It consumed a lot of power, it used tons of parts, it had some bugs i never killed and it only displayed the actual temperature.
I paused the project for a while.

By the time my µC skills increased and so on one day i decided to make a better version.
The requirements:
  • no batterie
  • no usb
  • no 7 segment display
  • should display something more than just temperature...
  • lesser parts
  • KISS!

That was the hour of birth for the thermometer version 4a:

The whole circuit is build around an Attiny84V and an LM35C.
The output is done on an LC Display from Displaytech.
1x16 Chars - or more precise: 2x8 Chars in one line.
Sadly without backlight.

After making some plans for the hard- and software parts i build up the circuit on an pinboard and then i made the software.
(Usually i never make plans for the software part.)
Last step was soldering the stuff onto a bredboard as you can see in the pictures below.
Because i made a lot of plans and "brain work" in the forefront, it was a very easy and straight forward implementation. No bigger problem appeared till now.

The circuit is using a wall power supply.
It is specified with 6 V DC, 300 mA and it is from an old wirless mouse charging station.
In idle time it delivers around 9 V and because the whole circuit consumes under 15 mA it will work in idle even when the circuit is connected. ^.^

As special feature i implemented a clock (wohoo!).
With three switches on the back you can set the hour, minute and the display mode.
Display mode means the appearance of the time and temperature on the LCD:
  • Mode 1: HH:MM:SS +/-TT,T°C
  • Mode 2: HH:MM +/-TT,T°C
  • Mode 3: HH:MM +/-TT°C
The thermometer should be able to display positive and negative temperatures in the range of -40 to +70°C.
But because it is getting warmer here outside i need some fridge to test the posibility of displaying negative values.
The build in clock is synced by an 16 MHz Quartz (CHKDIV8 is on - resulting in a clock speed of 2 MHz!).
The clock is not calibrated yet - but on the pinboard it was exact enough. Further testing with the breadboard circuit is needed.

The hardware version i soldered is a bit older than the plan.
As well as the software version.

The software is written in C with AVRStudio and WinAVR.
The main program consists of under 300 lines of code.
It uses 3132 bytes in the flash for code.
So there is plenty of room in the 8 kb flash for further extensions.
For the LCD i used the routines from Mikrocontroller.net.
(A big thanks to this side! It is just a paradise for µC users... at least when you can read german)
As soon as i figured out how to post software here i will upload it. ;)















Hey folks...

... here i am!
Electronic parts, source code, soldering iron, 1's and 0's, wires - that's my world.
Electronic is my hobby and it's beautiful.
In the following weeks, months (years?) i want to present you some of my work.
Perhaps it might be useful or at least entertaining for you. ; )
So lean back and enjoy.

puts("Hello World!");