Posts

Showing posts from April, 2010

Moving code from ESP8266 to ESP32

Image
A while ago I made a mashup of Dan Royer's code CNC 2 Axis Demo with my own code for trapezoidal motion stepper and servo control for ESP8266.

I assumed porting the code to the ESP32 would be trivial, and that was true for the most part: changes like library name being Wifi.h instead of Wifi8266.h were not a problem. UDP now does not like multicharacter writes but you can use print instead. So far so good.

However, when it came to the interrupt code I was stuck with the stepper interrupt causing an exception sometimes. And to make things weirder, the servo interrupt worked flawlessly (both of them had the IRAM_ATTR directive if you ask me).

Going little by little, I could narrow down the culprit to a floating point operation during the interrupt, that would cause problems sometimes but not always. Browsing around I found this post. Where the solution was simple: do not use floats within the interrupt routines but doubles. The reason was the float calculation would be performed by…

Animate the drawing of a SVG file

Several times I've blogged about Inkscape vector drawing software and its many uses. Being free software there is nothing to lose if you want to try it out. I use it on Windows, Linux and OSX happily.

For a new project I wanted to get a given drawing animated and maybe with a soundtrack. My goal was to use this for explaining some topics of my lessons.

Long ago I saw LectureScribe and I liked it. But it was not exactly what I was looking for, though you might want to give it a try too.

What I am showing you below is a rough demo (no music so I won't get any damn DMCA notice; yes I know there are copyright free music). I've used a Python script by Ed Halley to get a sequence of photograms. Next I've used mencoder to combine them to create a video I later uploaded to youtube.

It's a drawing of an stepper motor interface.



In case you wonder, I captured this drawing using a Genius G-note board.

I lost my parallel programmer

Image
A while ago I wired a 25-pin parallel port socket with three resistors to build a parallel programmer for burning Arduino bootloader on brand-new chips. I used several times and it was great. However I do have the need to use it now and I cannot find it.

I've bought an ATMega328 as a drop-in replacement to have more memory available for a project involving the Ethernet shield and UDP networking. Unfortunately, Arduino Mega does not have the proper pinout for the Ethernet shield, so the ATmega328 is my best choice. But the new chip I've bought was empty and I need to burn the booloader.

I do keep my old PC available just in case, but my new iMac does not have a parallel port either. So I remembered that there was another way of burning the bootloader with some extra wiring on a Diecimila board.


And the wires go to the ICSP header ...


This way the FTDI serial chip can be used to burn the bootloader in the flash memory of the ATmega. However, it is not as easy if you are not using W…

MicroRGB: A LED with a brain

Image
A recent project required to create a matrix of RGB leds. First prototype was set to a 5x5 matrix. For quite some time I've been thinking on the cheapest and more powerful way of doing this. Other people already answered the question in different ways. Either they put a micro controller on board, like BlinkM or they use a PWM shift register like ShiftBrite.

A while ago I learned of a website with several PIC-based projects in the same line, one of them it was a serial addressable RGB led controller.
One of the factors I was taking into account was cost. When you are using a large amount of units the unit cost becomes important if your budget is limited. I decided I wanted to create my own device. Should I chose a Microchip micro controller I could use the software mentioned above. My fist take was to use a 12F675 8-pin micro controller I found for $1 each on eBay. Unfortunately it seems too limited for the task of handling 3 PWM channels and serial communications as it lacks of a…

Yet another laser cutter

Image
When my EPSON 830U decided not to work for me anymore (printing heads clogged) I thought I could make some use of the still working mechanics of the printer. It's based on a couple of stepper motors for both axis of motion (print head and paper feed).
So I replaced the original power supply and drive electronics for an arduino board and an stepper motor driver from Adafruit industries. Now I could move the printhead anywhere on a page. Next step was to add a laser on the printhead and to control it using a PWM output from arduino (so laser power could be modulated from the computer).
Though it only cut thin back color cardboard, it has may uses. I wrote a C program for arduino to control the stepper motors and laser. It receives data from the computer and interfaces with the old printer guts.
Data format is very simple: each line contains a sequence of integer numbers separated by blank space. Each pair of numbers represents one XY coordinate. Line ends with a CR (0x0d) character (…