Skip to main content


This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - robots

Project logs / DTMF detector and generator

I have created simple DTMF detector and generator for STM32-103STK platform (olimex). It is based on STM32 cortex-m3 cpu, and should be easily ported to another platforms as well.

DTMF generator is based on AVR314 appnote, and the detector is my practice in signal processing using "Goertzel algorithm". Everything is written for integer/fixedpoint arithmetics. (no floats at all)

The source is not perfect and still needs some final touch. Right now the detector works and sets the generator to whatever it hears on input. The STM32-103stk board has integrated microphone amplifier and headphone amplifier that is fed from PWM output (through series of filters)

Generator generates signal using PWM, by changing the duty cycle each period. Two sine signals (low and high) are generated using LUT and mixed before feeding into the PWM.

Detection is done by using 8 simultaneous signal detectors. One for each frequency in dtmf. After 205samples energie of each frequency is calculated and peak detected.
Pirate PIC programmer / Major changes in the PicProgrammer

First of all, if unsure use "r1816" version of the PiratePicProg, which works and doesn't need any new firmware in buspirate.

I have posted the most recent commit to the SVN. The current changes are:
- changed Interface api:
Read, Write commands are not returning anything, Get Data returns data. This way you don't have to wait for every single command to be completed. You can queue the commands and send them in bulk.
This also means new programing protocol in buspirate (see below)
TODO: change read/write function prototypes.

- changes to Pic24:
the programming is done according to datasheet, no relying on command side-effects.

-Added first PIC16:
added 16f88x family programming protocol. Tested with (ancient) High voltage programming adapter. Supported is read, write, erase, write fuses. (Write user ID is blocked now and should work fine)

support for different word sizes (14, 16, 24 ...), also support for empty check on different word sizes.

-the new firmware:
New protocol has been added to the buspirate (also in SVN). Attached is compiled version that works, but the terminal interface has broken strings (binary mode works fine).

-future work:
add support for pic32
remove some divide by 2 multiply by 2 maddness. (actually word size maddness)
support for busblaster (maybe ?:)
General discussion / *nix programmer quiz
How many of you can answer this quiz without actually compiling the code ?:)

We have a piece of code: (quiz.c)
Code: [Select]
#include <stdio.h>

int main(void)
printf("hello worldn");
fork(); fork();
return 0;

Compile this code using regular gcc command:
Code: [Select]
gcc quiz.c -o quiz

And if I execute the compiled binary, it will print what everyone expects:
Code: [Select]
robot@robot ~/quiz $ ./quiz      
hello world

Question is, what will happen when i execute the code like this:
Code: [Select]
robot@robot ~/quiz $ ./quiz | cat

Have fun ;)
Pirate PIC programmer / Fixed PIC24 support

I have just committed changes to the PIC24 protocol. Now reading is supported, and seems to work correctly. (Tested with BPv4 as target - pic24fj256gb106).
Open Bench Logic Sniffer / Rewrite of ols firmware
I have rewritten most of the original firmware to something more comprehensive, and easier extensible.

This new firmware uses the USB stack written by JTR et al, with major rewrite of the CDC data buffering. Single buffer rewritten to circular buffer, blocking/non-blocking reads, single and multi-byte. No more magic state-machine.

Most parts work, but:
- missing FPGA communication loop
- bootloader jump, jumps,but USB never comes back to life.
- winbond flash not tested.
- writing flash fails occasionaly

link to repo:
Open source USB stack / typo in usb_stack.c
I found a bug in the "usb_stack.c" line 435:
Code: [Select]
        case USB_bmRequestType_Class:
            if (class_setup_handler) class_setup_handler();
        case USB_bmRequestType_Vendor:
            if (vendor_setup_handler) class_setup_handler();

The second case is calling wrong function - should call vendor_setup_handler.
General discussion / Bugtracker
Wouldn't it be great if DP had an issue tracker ? something like mantis, or bugzilla?

Most of the bugs, issues and ideas are written in forum. This is nice that it is written somewhere, but tends to get forgotten or missed.

This would probably help even with BP v6 firmware. There are couple of threads for each 6.x minor version change, and each thread has "todo". In the issue tracker one would see what issues are still open, and what milestone are they belonging to.

It would not replace the forum, just help manage the requested changes and issues could have link to the forum thread for further discussion.

This would also help with the future PiratePicProg. There are probably 3 things that are to be fixed, and many more to come. And even more will come after the batch of pic programmer adaptors.
With only 3 it is already starting to be too hard to keep in head :-). (or in forum threads)
The issue tracker would clearly show what bugs are opened and need to be fixed.

Any thoughts ?
General discussion / Embedded world
Is someone planing to attend Embedded world ?
It might be interesting + a way to get some free development boards :-D (olimex, etc ...)
General discussion / Display EDTCA22
Hi guys,

I have this equipment with LCD display (radio Icom ic-2800h). And the LCD Panel got broken.
Does anybody know about analog TFT display with part number  EDTCA22QB0? Any info, possible replacement, cross-reference, or anything would help :)
Its 5.5cm x 7.0cm in size. Input on lower right corner.
General discussion / End Of Year Development Tool Sale 2011
Celebrate the end of 2011 with up to 40% off selected Microchip development tools.

Enter "YES2011" upon checkout at microchipDIRECT to receive the discount.
Offer expires 5th January, 2012

14 Development tool kits are included in the offer,
choose from the list below and receive savings of up to 40%!!

    MPLAB® ICD 3 In-Circuit Debugger (DV164035)
    PICkitTM 3 Debug Express (DV164131)
    PIC32 Ethernet Starter Kit (DM320004)
    Microstick for dsPIC33F and PIC24H (DM330013)
    Multimedia Expansion Board (DM320005)
    MPLAB® Starter Kit for PIC24F MCU (M240011)
    Accessory Development Starter Kit for AndroidTM (DM240415)
    XLP 8-bit Development Board (DM240313)
    F1 Evaluation Platform (DM164130-1)
    Motor Control Starter Kit with mTouchTM Sensing (DM330015)
    MCP1640 Synchronous Boost Converter Evaluation Board (MCP1640EV-SBC)
    High Voltage Buck Converter 600 mA Demo Board (ADM00352)
    MCP16301 300 mA D2PAK Demo Board (ADM00360)
    MCP2200 USB to RS232 Demo Board (MCP2200EV-VCP)

Take advantage of this great offer - go to microchipDIRECT and place your order today!

This came in through email. Thought it might be interesting :-)

EDIT: http://
Bus Pirate Support / Enabling WDT ?

I'm having a bit of trouble with BP and PIC assembly :-)

I am trying to improve the OpenOCD protocol a bit, such that it won't get stuck in the middle of large data transfer, and user doesn't have to reset the BP manually. I want to use WDT for this purpose. OpenOCD main routine is written in assembly, and I want to enable WDT just at the beginning and disable it at the end.

I suppose that it should be just setting one bit, reseting it at the end and special instruction in the middle. But obviously it doesn't behave right. BP never gets reset by the wdt. Any ideas ? (BTW fuses are set to 1:1 postscaler and either 32 or 128bit prescaler, resulting in 1-4ms timeout).

Code: [Select]
Index: OpenOCD_asm.S
--- OpenOCD_asm.S (revision 604)
+++ OpenOCD_asm.S (working copy)
@@ -83,6 +83,9 @@
  push.w w12 ; save 12
+ ; enable wdt
+ bset RCON, #SWDTEN
  ; Init consumed byte counter
  clr w5 ; w5 = 0
@@ -201,11 +204,15 @@
  mov [w0], w0
  mov w0, U1TXREG
+ clrwdt
  ;  Outer (word) loop branch condition
  sub.w w6, #16, w6 ;  w6 -= 16;
  bra c, __loop_word ; } while (w6>=0);
+ ; disable wdt
+ bclr RCON, #SWDTEN
  ; Restore registers
 #ifdef HAS_DELAY
  pop.w w12 ; restore w12
Pirate PIC programmer / New data file loader
Hey guys!

I was quite disappointed that this project is on hold, due to the stupid hex parser i wrote :-).

So i sat down yesterday and I have written new "memory" management. It loads memory into linked list instead of continuous memory. It is able to handle sparse HEX files (eg. bootloader with fuses)

So far i have just small testing program implemented, which does reading and writing of hex files. It will need one night work to integrate it back into PiratePICprog.

I hope this will bring back the development to this project ;-)
Project logs / Reflow oven controller
I have bought this oven - . The main reason for this was to bake some PCBs. As with every reflow oven, this one needs temperature control as well.
I have baked several pcb without problem with unmodified oven. But that might be luck, as the temperature profile is nowhere near perfect.
I have therefore decided to make some simple temp controller to take care of the whole soldering process. As my oven features fan, I will probably want to control it as well. The contoller should not to need any special programmer (mega can by programmed with BP) and the board should be etch-able at home.


  • The whole thing is based around mega8 chip. There should be enough space for some pid, ramp generator, and menu. Oscillator is internal RC 8MHz.
  • User output is through 8x2 lcd display. Tiny display that will fit to the control panel nicely. This display is driven in 4-bit mode, to limit number of IOs. Backlight can also be controlled by the mcu.
  • User input is encoder with button. Both encoder pins are interrupt. Button is polled to save some nasty logic needed to multiplex.
  • Temperature is sensed by thermocouple and converted to digital using max6675, that i had lying around. Datasheet is saying that data is available every ~200ms. Little slow, but enough for this purpose. Big plus is cold junction temperature compensation and polynomial compensation.
  • Output is 2 channel PWM, 0-Vin. Both to be used to drive SSR (solid state relay). These relays can be bought off fleabay for about 3-6dollars/pc (free s/h).
  • Serial port is used to talk to bootloader, and to transmit temperature for further analysis (pid tuning)
  • Powered by 5.70-12V, voltage is regulated by micrel mic5202-5.0 (same as on BP)

There is no programming port for the atmega8. It needs to be programmed with bootloader before the max6675 is soldered. Reset and MISO pads are for this purpose.

The board:

The board is a bit larger than the lcd itself. Most difficult part is to solder the header. That needs to be replaced by smd version in next release. The board is designed to be piggibacked on the lcd. Small hack is Pot to set the lcd contrast. There was no smd pot available near, so I decided to solder miniature trimmer to the pin header directly from bottom side.
Board is single side pcb, with 2 jumper wires.

Finished board:

This board was not etched at home :-). It was made some local company that does UV etching, and they also apply silver coating to protect the copper.
There are few modifications not present in the picture above - gnd on middle pin of the thermocouple connector, voltage divider for serial port. Some parts are missing, and are not needed for lab testing (mic5205 voltage regulator, and big through-hole capacitor).

Thermocouple used is from sure electronics:

The thermocouple does take a while to cool down and I wonder if it is suitable for this purpose.

For user input I use incremental encoder, bought at local store. This seems to be not a good quality build. Tends to jump randomly back and forth.

The software:
Probably the hardest part. This part is still in development. So far the every peripheral can be controlled.
Finished is: encoder, button, display, max6675 temperature reading, PWM output, pid controller.
There are still missing parts like: ramp generation, user interface.

I will provide board/schematic files here on request. The software will be provided as well, once finshed.
Open Bench Logic Sniffer / Brand new OLS (boot)loader tool - Windows and Linux
I have just finished this tool - Ols-fwloader. It is mostly intended for linux, but should work with windows and other platforms that do support libusb-1.0.

The source can be downloaded from:

I have successfully tested it with my OLS, and it works fine. There is a little problem with first transaction, so don't get confused by the first "Com timeout".

The prerequisites are:
- gcc, and standard devel environment
- libusb-1.0

I have included lame Makefile, that does not use pkg-config, you probably will need to change the paths inside Makefile to make the compilation work.

I am looking for volunteers to  test it. Please just someone who has access to Buspirate, or other means of pic flashing. I have included several measures to protect the bootloader. But there is always a chance it will destroy its self. (The bootloader does not protect its self)