Older blog entries for svo (starting at number 6)

w00t! what a day, a perfectly wasted Saturday :)


:) FreeRTOS is up and running on my mega32;

:) TWI/I2C is working and display is interfaced through RTOS queue;

:) PID term coefficients are read upon startup and displayed;

:) Error term (inclination) is being measured and displayed continuously;

:) Other tasks run beeping and flashing asynchronously, inducing happiness around;

:( FreeRTOS AVR port uses 16-bit Timer1, exactly the one I was planning to use for phase-correct PWM generation. What a bummer! Hopefully it doesn't really need the 16-bitness of that timer, maybe I can hack it to use the other one;

Aside from that last little trouble which I'm sure can be solved, I don't have words to express how happy and easy it is with a sane uC, C-compiler, decent simulator too (talking about WinAVR/gcc and AVR studio, remembering MPLAB IDE, shuddering) - it's just so smooth and pretty now.

Of course I guess it would not be as smooth if I just started off for the first time ever. After all PIC made me learn a lot of stuff and I'm grateful.


My ATmega32-based board is working. So far I only have the uC, the led and the beeper. The new design also has the reset button and three potentiometers for PID term coefficients input. I'll need some time to figure how to do more sophisticated stuff than just blinking the led and beeping. Happy happy day.

Here's a pic of the new logic board (top) and the ISP programmer I quickly assembled to program the AVR (bottom). The schematics is based on PonyProg-STK200, but altered a little to accomodate what I had handy (namely, 74hc245 instead of the 244).

The experience with programmer software is not as smooth as I expected. The so-much praised PonyProg is a little bit TOO universal and it was not easy to figure what was going on. It works now though.

avrdude from WinAVR distro was a little more friendly at first (not user-interface kind of friendship though), but failed to read the fuse bit words.

Also a note on PCB's. I kind of found the proper combination of exposure time/distance for paper prints, finally. With my uberlamp (it's some hardcore UV lamp, not the regular kind that looks like a daylight lamp), it takes not less than 60 minutes from 30cm distance through an oiled print on regular office paper. I'm afraid this won't work with more commercially available lamps - just to give the idea of the power of this lamp - shining for 10 min from 10cm distance makes oil burn to the surface of photoresist and enough UV gets through the dark areas of the template to render the entire exposure useless.


what I write here begs to be a forum post, except that I can't find a forum to post into - so I have some questions:

1) Is there a way to contact other people on robots.net other than by posting in the diary?

2) Is there a robots.net forum somewhere? If it exists, I can't find any links to one in obvious places here.

to Pedro14: unfortunately for your project, I2C bus is not, and can not be, wireless. I2C was conceived at Philips as a mean to make many chips in a single device talk to each other via just 2 wires. You will probably have to deal with it when interfacing to memory chips, some sensors and displays. For example, I use it to send data to the display of Akipaki. Sometimes it is also called TWI (Two-Wire Interface), sometimes IIC, maybe there are some other names. Idiosynchratic of I2C are open-drain terminals, addressable devices and strictly octet-oriented communication protocol.

I think that your project is very complicated by itself, even without wireless communication. It is probably a good idea to develop the basic functionality first, probably develop a simulation of the entire system on a PC - that alone would take a lot of time. And maybe when the proof of concept is ready there will be some pretty, readily available, single-chip radio interfaces as simple as I2C is in the world of wires.

Hi folks,

I finally burned the controller board. doh. Did something wrong with power and mad currents flew across the MCLR pin of the PIC. It still works, but has input impedance of about 10 ohm, which is not tolerable.

Although a bummer, it's still for the good. I'm studying AVR's, looking into using ATmega16 on my new design. Hardware multiplier totally buys me. And most important, gcc for avr exists and I would not have to go smoking and procrastinating every time I need to multiply two signed integers. As of the rest of peripherals, everything is in place - 8 channel ADC, 2 channels of high-resolution phase- correct PWM, a lot of gpio pins and a ton of other purdy stuff I won't possibly need this time.

Take care. And always mind your power connections. Maybe using a fuse is a good idea, even.

9 Sep 2005 (updated 9 Sep 2005 at 10:46 UTC) »

smee gain..

Funny, I just discovered that there is (or was??) a robot football team based in the university I graduated from.

It's amazing that they exist in total obscurity. Here's one of a few news articles regarding their success in the long gone 2003. I tried to search for at least some info regarding them and found nothing but news articles.

One would expect higher level of tech-awareness from a winning robot-building team. At least a simple text-only site with contact information would be sufficient. Come on people, come out of the hole, we could benefit from each other.

At least I could :)

Also, there's another robot building community, which is pretty sparse though. Some projects listed are not even robots, more like heavyweight chassis constructions. Interesting nevertheless, check them out (the leftmost bold-font column starting with ATMEL... links to various user projects, some active, some from the distant past).

Re: icechip's accelerometer tutorial - that's a great one! Thank you for sharing. BTW, I see that most articles and reviews somehow miss Motorola/Freescale family of MEMS accelerometers. This may vary with supplier, but here I could buy their MMA6260Q (dual-axis, +/- 1.5G) for about 10e. That's at least twice cheaper than similar devices from Analog. The outputs of MMA6260 are voltages proportional to acceleration (or axis angle relative to g, if in g-sensing mode), which may happen to be very convenient if there's a multi-channel ADC on board already. I could whip up a quick description of my application just in case anyone's interested.

Assembled Akipaki again last night. The new construction is much sturdier and easier to disassemble/assemble than previous duct-tape-and-wire one. Pics are on the project page.

Decided to think about batteries later and focus on the PID control loop instead, while using external power. The RC servos seem to brilliantly withstand +12V without much trouble. The current was limited during the test though, so I'm still not sure yet. But anyway it's very nice to see that L6204 bridge is not heating, fully lobotomized servos spin and the controller is getting its +5V well refined and without spikes.

I wonder why it's next to impossible to buy raw gearhead motors, at least here? I have to buy a servo and rip it apart. Weird. Don't RC models of some kind need motors too?

Now I can get back to the firmware. That's the part I've been avoiding for quite a while.


The reason is the crippled PIC16 architecture. Strange use of flags coupled with anti-intuitive skip-instead-of-branch conditionals make arithmetics a little complicated. And those banks.. did they really have to spread all registers across all 4 available banks? Could not they just stay in one bank? The code on a multipage PIC (like the 16F873A i'm using) consists mostly of BANKSEL instructions, each of which is translating into 2 bit set instructions.. And since it's barely possible to know which bank was selected beforehand, it makes it 3 cycles per instruction (user register file is banked too), so where's the advantage of RISC??? Microchip, tell me? It's great that I haven't yet crossed the first program page boundary - the day when my code spans across 2 pages is the day of doom - all calls would have to become long-calls. And it's not really surprising that there's not a single decent C compiler for this abomination of computing, let alone freeware one.

The only thing that's great about PIC's is documentation though. I guess that's how they get people hooked. At least that's how it happened to me - first one's free.



Currently my 2-wheeler is a disassembled set of parts and boards (which used to be assembled once but had too much problems that screamed for hardware solution).

Originally I wanted to control RC servos modified for continuous rotation, but this proved to be a very bad idea. Balancing works, but overshooting in control is inevitable and it's nearly impossible to implement fine control. Basically I have "full throttle back" and "full throttle forth", without anything in between. Thus i decided to build another board with H-bridges that would replace RC servo electronics. With it I can implement PID control of the motors.

The real problem #1 now is the power though. The logic board needs good and stable +5V (well, more than +4V anyway, the stability is more important that absolute value). The motors can run at +5, but the H-bridge chip I'm using needs about +7..+8V or more to boot.

It looks like having 2x 4-piece AA battery holders onboard is inevitable. Thus I could get 9.6V when using rechargeables. Any ideas regarding power/batteries are welcome! And just out of couriousity, for how long a typical "standard RC servo" would stand 10V DC? 10V with 50% duty cycle?

Share this page