Showing posts from March, 2010

Moving code from ESP8266 to ESP32

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…

The power of DVD lasers

Next time you see a broken DVD writer unit, do not throw it away. It contains a powerful visible LED laser. Some lasers used for CD-ROM writers are infrared and, while powerful, the light emitted is not visible, making it both, staying safe and focusing it, more difficult.

In order to achieve some impact on a dark surface you need to give a decent amount of electric current to your laser LED (from 150mA to 300mA or more) and, besides, you need a lens to focus the beam. Focusing is important so as to concentrate the beam energy on a small spot (like you do with a lens and the sun light to burn a spot on something). If you are disassembling a DVD writer, you may look for the focussing lens too. If not, you can get one like this.

Some guys did make what they called a $50 laser cutter, sounds cool. I'm retrofitting an EPSON inkjet printer to do a similar thing.

Self-replicating machines

You may have heard of Reprap, the 3D printer that prints itself, but if not, I'm sure it'll make you curious. The idea of 3D printers is that you can "print" 3D objects you've designed on a CAD program. Reprap printer or MakerBot are machines that can create 3D plastic objects by fusing plastic into small plastic spaghetti (that adheres itself while hot) over a movable table. Objects are created putting one layer on top of the other.
Given the fact that you can print 3D plastic objects, Reprap project went on to do design in such a way that a finished Reprap printer would be able to print all the plastic pieces to make a new one. Unfortunately metal parts and electronics still need to be bought elsewhere.
Care has been taken to provide open specification for all the components so anyone can build their own easily. Reprap first version was named Darwin (shown in the picture) but a new version is out, named Mendel, with many improvements, smaller footprint and bett…

On addressable RGB LEDs

I've been interested on the possible uses of RGB LEDs for quite a while. The underlying logic is pretty simple: Pulse Width Modulation can be used to control the luminosity of each color, giving as a result a similar system to how pixel color is controlled in any RGB display.

While creating a LED-based screen is possible and it's being done commercially, the size, power consumption and dot size make it only useful for large screens for sports or music events.

At a smaller scale this same technology seems cool for arts projects. The problem is that while many microcontrollers can do PWM, they have a limited number of outputs, and three of them are needed for each led.

Alternatively a matrix-like is possible for controlling arrays of RGB LEDs, but sacrificing its maximum luminosity.

Searching around the net several solutions pop up: serially addressable LEDs using one microcontroller for each LED, a serial-register-based RGB LED controller and an I2C-bus RGB LED controller.