Marco's Corner

Just another Software Developer's Musings

Just some photos from last night’s lunar eclipse. I was mostly lucky, the high clouds did not materialize as much as feared;-) I did only stay up until about the peak of the eclipse. That was long enough for me;-)
DCS_0070_768DCS_0073_768DCS_0097_768

DCS_0100_768DCS_0114_786DCS_0116_768

DCS_0126_768DCS_0128_768

makers   beginnersOK, nobody knew what to expect for our Arduino Day event. But about 20 makers had a good time @ Robot Garden ;-) Most knew their way around. But we also had a couple of kids who were new to the idea of `hardware hacking’ and liked the idea of an easy start. So instead of a big presentation, I gave them some 1-2-1 time;-) That worked pretty well.

Just for reference, my prepared presentation as LibreOffice ArduinoDay.odp & ArduinoDay.pdf files;-)

table2table1Some photos (not taken by me;-)

As always, have fun exploring;-)

– Marco

Arduino Day 2014We will have our own event @ Robot Garden in Livermore, CA to celebrate the 10th Birthday of Arduino – The little computer that can;-) I brought it up, so naturally, I got to organize the event;-)

More information is available at the meetup page for the event.

I hope, we will have some interesting people and some good demos, but as always, the Arduino ecosystem lives from the participation of individuals;-)

I hope to see you there;-)

 

Scale - TestsScale - In BalanceOK, the “Compound Machines” event @ Science Olympiad is a closed event comprised of a written part and a more practical part, where the team needs to use a pre-built “scale” to determine an unknown mass with the help of a known mass. So I don’t have a real video or images of the event. All the pictures were done afterwards. The rules for the scale are in the official rulebook;-) I’ll just try to collect some “lessons learned” and some pictures for reference.

  • Use the longest levers which still fit into the rules. With longer levers, the significance of the limited accuracy of the length measurements decreases.
  • Find at least some parts with with “nice round” values. In our setup, the active length of the second class lever was 45 cm and the fixed side of the first class lever was 11.25 cm. That made the equation somewhat easier;-) Mu = 4 (a/d) Mk
  • Try to find good bearings;-) Brass bushings with brass washers on both sides worked kind of OK.
  • Make sure, you calibrate the apparatus with the hooks.
  • Include the masses of the attachment hooks where you hang the masses in your calculations!! We missed that part during the preparation and so the results were somewhat off during the competition:-(

Scale - DetailScale - Bushing So overall, the Millennium team was not very successful in this event. But there is always next year;-) I hope, the kids learned something regardless. Just to keep track of the spreadsheet: Scale – Spreadsheet

Have fun;-)


OK, this year, it was the second place for our team in the Maglev event in the San Joaquin County competition. I only saw the runs of our vehicle and there the problem was, that it was way too fast. The target time was set at 12 seconds. The successful runs were around 3.7 seconds:-( Way too fast. But trying to slow the car down and it would not start at all:-( So there is probably a better way. If next year has similar rules, I guess we need to experiment with side magnets to keep the car from twisting?! But at least the moving weight of 1950 grams (weight limit was 2000 grams) helped the score;-)

Maglev VehicleSome more details of Maglev Vehicle from the frontthe car. One of the EDF from last year (GWS GW/EDF55-300H’s) had to do all the work alone. A little bit a bigger battery, a two cell LiPo (7.4 V) with 5000 mAh just for the extra weight.

The maglev magnets were built out of  8*4 of the Kelvin maglev magnets each. That was partially needed to float the weight, but also to as weight low in the vehicle. They were glued together and to a steel profile at the top.  There was a little box between the magnet assemblies to keep them parallel to the sides. It was also used to add more weight low in the vehicle. All of that was attached to the plywood base via the usual Velcro strips.

Magnets separated from the baseMostly taken apartWe experimented with a 1.5 Ohm 20W potentiometer (actually a 3 Ohm potentiometer parallel to a 3 Ohm resistor, both rated at 20 watts). But that did not work so well. It worked as expected to slow the motor down. But even minimal slowing was too much to get the car started reliably:-( More to experiment with next year;-)

The blue rectangles in the last image are extra weights which were normally under the battery to come close the the weight limit;-)

Al always, have fun exploring.

Last night Paul Zander, Bob Smith, and I gave a presentation/demo for the Silicon Valley Linux Users Group on little computers ranging from Arduino to Raspberry Pi and friends. I believe the audience had a good time and we had interesting discussions afterwards. My slides are here SBC_SVLUG_mw and most of my demos are described in more detail somewhere below;-)

As always , have fun exploring

 


I played with the Robotis CM-900 and the little MinIMU board before. But so far, I always used the Arduino libraries directly from Pololu. One example was my little teddy seat ;-) This time around, I decided to take the Arduino out of the equation and and let the CM-900 do the I2C communication with the IMU. That seems to work pretty well after a couple of changes:

  • I think, I found a little problem in the OpenCM Wire library implementation. I posted the proposed fix at the RobotSource forum here.
  • I had to make some minor adjustments to the Pololu library sources to make them work with the OpenCM environment. Overall they are written very well and the switch from a 16bit Arduino base to the 32bit CM base was not a big problem. I forked the repos and my modified versions are available here: L3G library, LSM300 library & MinIMU-9
  • I’m running on Linux, so the requirements for the MinIMU-9-test.py needed to be adapted a little bit.

But overall it works pretty well.

BioloidBack1_1000BioloidBack2_1000Since I wanted to keep the original Bioloid setup intact as much as possible, I had to find a new place for the little IMU board. I used a little wooden carrier and some double sided tape;-) Now on to the next step. Trying to get the robot to walk with the CM-900 instead of it’s original controller;-)

As always have fun.

– Marco

OK, I’m trying to play with some embedded systems once in a while. This time around I was trying to implement a relatively fast (1000000Baud) asynchronous serial connection with an Arduino Micro. The Micro is running at 16MHz, so that connection gets close to what should be possible. I implemented my protocol handler and it seemed to do the right thing for some time, but stop dead at some random point in time:-( I verified that a couple of times on the other side of the connection (a Robotis CM-900) via an simple loop sending a READ command and blinking a LED when it received a valid response from the Micro.

So how do you find out what the Micro is doing when it falls of the rails? A normal serial protocol (over USB or otherwise) would change all the timing and would add more interrupts to the mix. That’s when I got the idea of using some digital output pins and a (cheap) logic analyzer to protocol what was going on. I don’t know, if this is a common technique in the embedded world, but I’m normally working with more powerful systems where I don’t have to look at logic levels;-)

I added some (in this case four) digital output pins to the Micro sketch and created a little macro to “pull a certain pin down, wait 4us, bring the pin up & wait another 4us”. I used the 4us timer because that’s officially the smallest interval the Micro can handle. It seemed to have worked OK for my case, but can easily be changed. I added that macro to some potentially interesting places in the code so that I could distinguish them later. Overall that method did not add much time during the run and more importantly, it did not add any additional interrupts.

FirstIncompleteResponse2LastCompleteResponse2The first screen shot shows a complete cycle. The CM-900 sends the READ request and the Micro responds and finishes the functions as it is supposed to.  Click on the thumbnail to see the larger version with some explanations on the different markers.

The second screen shot shows the markers for the time when things fall apart. The marker `before the HardwareSerial.flush()’ is the last recorded marker from the Micro. So, the HardwareSerial.flush() did not return. That brought me onto the right track;-) With the help of two nice people on #arduino @ freenode IRC, I got pointed to a patch on github, where somebody else was running into the same flush loop. I tried the proposed patch and the setup works fine now;-) Even after extensive testing (something like 2500 rounds), I did not see the hang again. Before it happened usually somewhere between 30 and 100 rounds.

IMG_20131016_191523_1000Now I can actually go back to my initial project for which I need that protocol stack, extra intelligent sensors for my little robot. Right now, it has a lot of extra stuff on it’s back and can’t walk:-(

As always, have fun exploring;-)

My never ending story with Tomcat and logging.  The previous posts are here and here. This version has two updates.

  1. Tomcat was still sending the System.out and System.err streams to the shell and eventually to catalina.out in the normal configuration.  The jar file now contains a life cycle listener which can be used to redirect those to syslogd as well.  Just add a line like <Listener className=”org.apache.log4j.contrib.ServerLifecycleListener” /> to the to of the server.xml after all the other <Listener> elements. The new streams will show up as [stderr] and [stdout].
  2. We use JRuby on Rails inside our Tomcat. That setup sticks sometimes many lines including ‘\n’s and terminal color codes into one logging message. The normal  SyslogAppender class will split the message based on the maximum length for syslogd. But that does create messages which are hard to read. So I created a subclass of the org.apache.log4j.net.SyslogAppender, called org.apache.log4j.net.NlSplitSyslogAppender, which splits any message on ‘\n’ and also cleans up all the terminal codes which just add clutter to the syslogd messages. Just replace the org.apache.log4j.net.SyslogAppender with org.apache.log4j.net.NlSplitSyslogAppender in your log4j.properties to play with it.

The updated jar with all the sources is mw-syslog.jar. Maybe I’ll create a github repo eventually for this. Every time I hope it’s the last change, but I come back to again and again.

As always, have fun,

Another experiment with the Robotis CM-900 and my Arduino ADK. This time it’s using a Pololu MinIMU-9 v2 and three Dynamixel AX-12A’s to try to keep the little teddy bear straight and facing North. Sometimes the sensors get a bit confused and the actuators follow to create interesting circle patterns. But overall it seems to be working ok.

Some things I learned;-)

  • Don’t try to put a compass sensor too close to electric motors;-) When you think about it, it makes sense. But I needed a while to figure our why the sensors delivered different/strange values whenever I tried to turn the motors on.
  • Also acceleration/deceleration would need some extra considerations to make the movements somewhat smoother.
  • The ADK seems to be happy being supplied with power through the `reverse’ USB connection from the CM-900. I’m not so sure if that’s a supported feature, but it seems to work OK.
  • Using human readable lines as the interface over the USB connection makes testing the pieces easy. But parsing them needs some effort. I had to modify a sscanf() function source for the CM-900 because the normal libc version would pull in to much and create a too large image to upload:-(

IMG_20130605_215418IMG_20130605_215502Here are some more images of the setup.  The two source projects are here: Robotis_Pan_Tilt and Robotis_Pan_Tilt_CM900

As always, have fun combining things;-)

– Marco