Simple IK

I came over this link while looking for a simple IK to drive a simple 3DOF robot arm I am making for work.

There is also this youtube video.

I have shamelessly copied his code here, and I intend to improve upon it for my own project and maybe post an update.

const float cx=2; //coxa
const float fm=6.2; //femur
const float tb=8.3; // tibia
float L, L1;
float alpha, alpha1,alpha2,beta,gama;
void setup()

void loop()
trigono_xyz(2, 4, 6); //contoh x,y,z
Serial.print("gama= ");
Serial.print(", alpha= ");
Serial.print(", beta= ");

void trigono_xyz(float x, float y, float z)


Reading Emcotronic M1 roms

I have sucessfully read the roms from the M1 mainboard using the TOP853 rom programmer.

The process was surprisingly smooth. I was prepared for all sorts of problems along the way, but it just worked. Uncanny...

I ran the TOP853 software from virtualbox to read the roms into .bin files and then i used bokken from the ubuntu repos to parse and look at the files. This is how I did it:

Open the chip select dialog in TOP853.

Type in 27256 and select EPROM.

Select a long delay for reliable reading.

Start reading the chip into the buffer.

Save the buffer to .bin file.
Open bokken and select the .bin file.

You can browse the dis-assembled code.
You can view the strings table.
The plan ahead now is to buy a few replacement roms (modern variants with identical pin-out) and copy the images over and see if they work. Once they work I can start modifying the code slightly.

Figuring out what to change in the code and where might seem harder than it is. I thought about ho to do it and I came up with the idea that the strings tell me something about what the code does, so all I have to do is to follow the strings and see which code pushes the strings around. Next I just identify which strings relate to which functions (such as loading/saving MSD data) and hijack those routines by jumping to an unused location where I have some space for my own code.

Well in theory at least.

TOP853 rom writer under Ubuntu

The TOP853 rom programmer arrived a few days ago and I just had the chance to check it out.

Since I run Ubuntu as my primary desktop OS, I thought it would be nice to see if I could get it working there somehow. Unfortunately the programmer is married to a proprietary windows-only software, and installing that under wine was a futile endeavour.

I ended up installing a small XP 32bit image under virtualbox. I had to install guest additions, add my user to vboxuser group and reboot to have USB working. I identified the USB device by detaching it and reattaching it and seeing which entry in the list of devices changed in the vbox USB filter settings.

TOP853 running in XP 32bit in virtualbox under Ubuntu.

Mor on this soon.


Emcotronic M1 EPROM + Static RAM + CPU

Small update on the EMCO.

After posting a few inquisitions on practicalmachinist.com and cnczone.com (major cnc related forums), without a single response at all I felt a bit discouraged. But to quote someone special; "When I get sad, I stop being sad and be awesome instead".

So now I have dragged out all the cards from the M1 computer and started probing them for intel (pun intended). It looks as though the card with the reset button at the back, called "R3D415000", or "Datacontroller" is the culprit.

Big picture
Unfortunately none of my cameras are operational at the moment, so only a stolen picture.

It features among other things the following IC chips:

I haven't bothered listing the rest of the chips as they seem to have lower level functions.

I have also ordered a cheap eprom programmer that supposedly handles the 27256 chips on this card. The plan is to read them in and look at the code (should be in x86 machine code, which there are lots of tools for). If I want to fiddle with it, I can probably write the possibly updated changes to more modern eeprom chips of the same spec that go into the sockets on the card. If I get anywhere with this, I will try to patch the code so that I can run my own subroutines attached to button clicks on one of the inert buttons in the display (there are at least two buttons with no symbol on them, that I guess are just legacy/future-proofing).


Body material and structure

I have been bending my brains on the matter of how to build the robot body. There are so many options for materials, structures and methods each with their own benefits and downsides. So after contemplating for a while I realized I needed to summarize what parameters are important for my robot before proceeding.

Toilet paper roll robot

I want the robot to be robust to the point that it can roam and tumble about in unknown terrain without wearing down or breaking. This includes the occasional fall and crash.

I want the robot to be energy conservative. This means indirectly that it should be relatively light, so it does not have to drag around a lot of unnecessary mass.

I want the robot to be very flexible in its degrees of freedom, acrobatic if you will, so its limbs may be very slender with long ranges of motion.

I want the robot to be precise in its motion and sturdy. A lot of this comes from the ability of its body to remain composed in any configuration, and not wobble or bend.

It would be beneficial if it is easy to work with the chosen materials, and that they are not prohibitively expensive to acquire, so that I can play with prototypes before deciding on a final design.

In the far end of the spectre, I want it to be hard to detect on radar, have a neutral heat signature and resist heat,  shrapnel and projectiles from conventional weaponry. OK, so I watched too much mech anime.

So what options exist?

carbon fibre profiles

We could use Aluminium, Stainless Steel, Carbon fiber, Glass fibers, Plastics, Nylon, Wood, ...

We could create a cage from joined profiles.

We could combine cage elements with wires and cloth to create intricate shapes with  "skin", as is common in glider aircraft design.

We could simply make an empty hull by welding or bonding plates.

We could cast solid parts.

The idea I ended up with that appealed the most to me is to build a cage from carbon fibre tubes, bonded with strong adhesive to custom machined aluminium end pieces that provide all the necessary contact points such as bearing hinges for the joints, ball joints for actuator connections and ground contact shoes.

The idea came when I was browsing alibaba.com (again), and I found a bunch of suppliers of carbon fibre profiles. Next I found a tutorial on how to work with carbon fibre as a material, which seemed pretty straight forward.

Carbon fibre is really strong and light when it is used properly, but using it properly can be a challenge. You cannot simply drill a hole and fit it with a bolt like you would do with a steel tube. The carbon fibre tubes require that the strain is applied evenly over a larger area, and to do this we need to bond the tubes to a ferrule of some sort. If this ferrule is made from machined aluminium that in turn is bolted to whatever we need then we are set.

perspective illustration of carbon fibre tetrahedron robot limb cages

When thinking in "cages", the design for limbs is self evident. We simply construct oblong tetrahedrons cage configurations for each limb. The knee joint is simply a double bearing hinge that connects two limbs along axis of the knee joint.

The thigh joint is more complex, it could be solved by creating a ball joint in a single point, or by introducing a third intermediary limb to separate the two axis of the motion into two separate hinges similar to the knee joint, that are situated perpendicular to each other

In the illustration above, the ground contact foot is marked A, the ball joints for actuator connection are marked B, the knee joint is marked C and the thigh joint is marked D (in this illustration it is simply a ball joint for simplicity's sake).


Generator update

I have been stuck with progress for some time on the generator. It turns out alternators are hard to come by for free/cheaps. While i continue to look for alternators i have turned my attention to the "other end" of the motor, where I will be fitting the starter motor in place of the recoil starter.

After initial investigation, i made a makeshift tool to remove the wheel attached to the shaft that the recoil starter grabs durin a pull, and verified that the shaft is right way threaded M6 (5mm ⊙) with 1.0mm threads.

I have purchased two one way bearings of ebay and the plan is to make a 10mm ⊙ adapter with M6 hole to fit on the shaft and then slide on a one way bearing which in turn will be driven by a small electric motor somehow. Not sure how yet, i need to get some experience with one way bearings first. Peculiar thigs they are in deed, and from what i have read the can sometimes be fickle.


Small update

Since my last post I have been very busy. To summarize, I have aquired an old arc welder, and put it into order. I have discovered that i need a qualified electrician to install a bigger fuse in my workshop. I have mounted a standard servo to the throttle of the honda gx25 and remote controlled it.
I have ordered a bunch of atmel development boards and other ecu-relevant components from dx.com. I have been rather unsuccessfull at dismantling the freewheel from an old bike, and have decided to look for another. I have looked for alternative alternators to use for power generator, but found none so far. I am also currently investigating how to handle fuel pump and choke from ecu. Right now I am looking at just mounting one servo per function.
I have made very little progress on the emco cncs. Lastly i discovered that the parameter memory lasts much shorter than the advertized 3 months and decided to craft a serial cable so as to avoid having to manually enter the parameters all the the time. The cable is almost done, with just one shortcircuit that needs fixing.
Stay tuned!


CNC Cheat Sheet

So my EMCO mill suddenly started working after months of stress and although I have become fairly familiar with operating it I quickly realized  that I know diddly squat about the important CNC milling stuff like G-Code or  how to work a CAD/CAM software to actually be efficient at milling. So I googled "G-Code cheat sheet", and to my amazement not a single high-resolution, colorful, to-the-point, well explained PDF file popped out. I was flabbergasted.

But, there were, after some digging plenty of black-text-on-gray-backround websites with comprehensive lists of G-Code that would be very useful. If only they were in printable format, to hang on the wall behind my machine...

So I decided to make one!

G-Code Cheat Sheet
Original files:

Download G-Code Cheat Sheet in .SVG format.

Download G-Code Cheat Sheet in .PDF format.

Please note that I am an absolute beginner, and I have made this sheet to learn this myself. I will not be held responsible if the information is wrong. Please do not hesitate to let me know if you find mistakes or if you have suggestions. Thanks!

Here are some sources I used:

Other Cheat Sheets i made:


EMCO M1 update

I now have no less than 3(!!) EMCO controllers in my workshop. And most importantly, I have all 3 axes working in my original F1P!

After determining that my EMCO F1P CNC machine had some issues with the controller (more specifically a fried step-motor controller board), I was feeling the despair creeping in. I started googling frantically for spare parts and repair options online without finding anything reasonable. The very next day I struck gold. A full F1P system for sale at a resonable price and in "promised ok state". A few days later I suddenly had TWO CNC mahcines in my workshop. But I had bought a dead system, and the guy I bought it from just repeated his original lie when I called him.

Two EMCO M1 controllers side by side

Despair was yet creeping in. Then, by another happy coincidence I found a controller for one of the EMCO lathes (T1) which is based on the same technology as the F1P for sale at a bargain price (Thanks Torgeir G.)! After verifying that it contained the same step-motor board i was pleased to buy it.

R3D413000 Step motor driver board in EMCO M1 controller

And after some fiddling about I finally have a working controller! The idea now is to put the original machine back in order using parts from the second and perhaps sell it.  The rest second will the be retrofitted with new drives and a modern PC based control. So far, my searches have turned up the following parts that may be of interrest:

Control board

Motor drivers

This has become a bigger detour than expected for my original project, but really I had to protect my initial investment which was substantial. Now that it works it will at least maintain its price if not go a little up.


First impressions EMCO

Just a quick note on the EMCO CNC machine.

It looks kind of cheap the first time one lays ones eyes on it, but after tinkering with it for only a short period of time it has become apparent that is is of extraordinary quality.

Some of the engineering choices made during its design are truely free of comprimise.

For one, the computer has a sealed chassis cooled via a huge air-to-air heat exchanger that prevents dust to enter the electronics.

The electronics are spaced out with lots of clear to read maintenance instructions and lights to signify problems.

All the parts are of highest quality brand and make, such as the kraus & naimer switch with KABA lock system.

In the CNC machine itself, all the parts are made of quality steel, machined to perfection. Many clever solutions prevent dust and dirt to reach the contact points and ball-bearings.

The steppers have additional metal optical encoders to keep them in check, so does the spindle motor.

All cabling is masterfully arranged.

I could go on and on. In conclusion, this is a magnificent piece of equipment that I am looking forward to getting up to par.


EMCO in the workshop

Just a quick update.

I FINALLY got my EMCO CNC machine into the workshop. I have already started the work on cleaning it up and troubleshooting it. And here are some pictures:

EMCO F1P - being cleaned

EMCO Tronic M1 - without front panel

Moving 200kg alone takes time

In my car

My assistant working


Protobuf for embedded

I have recently had the opportunity to research potential binary protocols at work. The thought just occurred to me that Google's protocol buffers (a.k.a. protobuf) might be a good candidate for the serial communication that occurs between different components such as controllers and servos.

You might think that it has too high overhead, and that may very well be the case. On the other hand protobuf has a few advantages that may not be obvious before you start using it.

For one, it makes thinking about your protocol much easier. The .proto text file format is just brilliant for recording your latest and greatest ideas for a protocol.

Second, you can actually use the code that is compiled by the protobuf compiler, not only for transfer of data, but also as your internal representation of the data. This will save memory, and that is good.

Third, it makes changing and even managing versions of your protocol effortless. For an embedded hardware project you might think that is unnecessary, but at least in my project with 36 servos with custom firmware and probably a whole bunch of other little controllers responsible for other stuff, with protobuf you could just change the .proto files, rebuild the firmware binary, upload it to the right controllers and be done.

I will investigate what impact protobuf has on the performance of tiny controllers, and on the bandwidth and latency of the serial communications, and report my findings here.


Interresting material PVDF

I was exploring the web when I came across an interresting material called PVDF (Polyvinylidene Fluoride).

Basically it is a plastic that is both piezoelectric and pyroelectric. That means that it will build up electric fields when you squeeze/bend it as well as when you heat it.

In this interesting presentation, they demonstrate how a small sheet of this plastic can be used in sensors to detect both movement and heat.

PVDF sensor
This first thing that popped into my mind was that I should investigate how this material could be used as a "skin with feeling" for my robot.

The approach I would like to test is to simply cover the robot in a sheet of crumpled PVDF connected to an array of electrical probes, and then simply empirically collect data from the probes as the robot changes pose. The data can then be fed into a learning algorithm of some sort to detect abnormalities from the expected pose an the real pose.

I also have another use for this material in the robot, but the ideas are too far off to put on this blog just yet. Maybe in a later post :-)


New workshop and other new stuff

I have just recently bought a house. It sports a rather large garage, and if you thought I was going to keep my car in there, you must be new to this blog...

In addition to the garage, I now have a small room in the basement dedicated to be my robot-office for writing software and designing parts.


Dedicated office
Right now both the workshop and office are just collections of junk. My plan for the workshop is to build a continuous workbench along the left and inner wall, totalling over 10 meters of workbench. This way I don't have to clear space whenever I need it. I just dedicate separate places of the bench to different projects or types of project (such as one area for electronics, one for metal working etc).

The right wall will have "gear on wheels" such as my CNC machine (which sits on two wheeled tables). Yes! I have promised to cover the CNC in more detail, but since it has been stuffed away safely in my buddy's garage, I really haven't been able to give it much focus.

I have also switched jobs, and now I actually get to do robot-ish stuff in daytime as well. I have finally landed a job where I get to do the things I really like! You can check it out here.

New biological robot.

I have made yet another awesome biological robot. This time it is a female. I fall in love with her every time I see her. She is already playing nice with the one I made earlier.

Female biorobot