Marco's Corner

Just another Software Developer's Musings

Our kids are off to college now but I could not stay away from the Science Olympiad fun. So I plan to play the Event Manager for theimg_20161017_235808Division C – Electric Vehicle” @ the San Joaquin County Event.  That will be my first time to run an event, so it will be quite interesting.

The event does not need to much preparation except for a pretty far reaching timing setup. Schools might have the Vernier Photogates which can be used with a laser pointer as a long-range solution. But I wanted to try to build my own `lower cost’ solution for people outside the Vernier eco system;-)

I build some little photogates earlier for testing our Maglev vehicle for 2013. They worked fine for that setup, but they would not work for the Electric Vehicle event because their short range.

So I knew, I needed some laser diodes as light sources and a receiver side which would work with them. For the diodes, I found little diodes @ebay, for instance 5* 5mW for Arduino for < $8 , but there are many choices out there. 5mW is what the normal laser pointers are using and it is more than enough for the distance we need. I did choose a red beam to make the lines visible. With a IR diode, I might have been able to use my original detector, but it would be very hard to aim:-(

laserreceiver_schemFor the receiver side, I choose the SFH 3310 photo transistor. It’s relatively cheap @ $0.83/per and it seems to work pretty well. I added another transistor and some resistors and LED from the parts bin to the receivers to that I can quickly see that the link is closed. The final circuit is shown in the schematic. Overall electronic parts cost for two gates is < $10.

I designed little enclosures for the receivers to hold the electronic pieces and also help to keep ambient light away from the photo transistor.  They were 3d-printed but needed a little bit work to make them fit as I wanted. I also printed little adapters for the laser diodes to fix them to LEGO stands. 3d

On the software side, it’s almost the same as the original gate setup. The receivers interface to an Arduino which does the timing. The laser diodes have an Enable pin, but so far, I left them simply on. The updated sketch is here: lasergate It also includes some local LEDs on the Arduino to see how it sees the receivers and a little display to work without a big laptop/display. Both are not really needed, but nice to have.

 

I also rebuilt my adapted dclock widget dclock-2-2-2 and it still seems to work on Ubuntu 14.04;-) I was running it on my laptop, but it should be easily buildable on a Raspberry Pi or similar;-)

Overall, I’m very happy with my setup. I tested the beam range to > 4 meters (the length of the wires I was using) and they worked just fine;-) So, that setup should work just fine;-)

As always, have fun exploring;-)

Update 11/09/2016: It turns out, my original scetch was sometimes slow to react. So I updated it to limit the LCD updates to about ten per second. That helped a lot. I now reliably pick up a 6mm (1/4″) obstruction at more than 6m/s (13mph). That’s fast enough for me;-) If it’s still a problem, I would remove the running updates for the LCD completely and show only the final time.

The new sketch is here: lasergate_20161109

3D Printing with NinjaFlex

No comments

img_20161029_155112_1024 I found those nice little lighted costume horns @ the Adafruit tutorials. So I had to try to build my own pair;-) They were 3d-printed out of a nicely flexible filament called NinjaFlex. Playing with that opens a whole new area of potential uses. But first, the printer has to be able to handle it. My little HobbyKing Turnigy Fabricator printer has an open space between the filament drive and the actual hot end. I learned very quickly, that the NinjaFlex needed extra guidance there. (Normal ABS filament works just fine).

My first attempt to overcome that problem, was a little piece of Teflon tube. That kind of worked, but eventually, the filament would push the tube to one side and then out of the drive. So, I was on the right track, but needed to stabilize  the tube more. Since this is sitting right on top of the hot end, I did not like the idea of ABS, so I opted for a bit of wood;-) Cut to the right shape and the little wood piece works perfectly. The wood piece is just laying there but that’s enough;-)

After the img_20161029_155647_1024mechanics were working, the next step was (and still is), to find the right parameters for Slic3r to create successful prints. The first attempt with layer heights of 0.1mm worked OK for a little test cube, but not so well for those horns:-( I was also printing way to fast.

My latest parameters are:

  • Retract:
    • 0.1mm (probably to be increased to 0.25mm or more, still a lot of oozing)
    • lift 3mm, without that, the moves sometimes bend the piece over when moving
    • 40mm/s speed
  • Temperature
    • 230C
    • Bed 40C, should even work with unheated bed.
  • Printimg_20161029_155103_1024
    • 20 mm/s speed seems to work ok
    • 0.25 mm layer height

The last horns are still not perfect, but they look interesting enough for their costume use;-) So, I’m happy for now. When I need to print more form stabil pieces as a seal or possibly as dampening elements, I might pick up with those parameters again.

Theimg_9566 first trial run at the little Halloween potluck @ RobotGarden in Livermore. The LED strips work but since the ambient light is pretty bright, not much can be seen:-( Thanks Andra for sharing the image;-)

 

Have fun;-)

— Marco

 


OK, this tooArm1k quite some time but some info to our entry for the RobotArm event for the Science Olympiad Division C. This robot is probably overkill for the event, but maybe other teams can find some interesting tidbits for the next iterations of the event. After our first attempt with the team of our daughter in 2013, this was the second version with the team of our son. In the three years in between, we got somewhat more into the whole robotics area;-) I competed two times in the RoboGames and overall learned a bit more about the whole area.

So this year’s robot arm is using mostly Robotis Dynamixel AX-18 & AX-12 servos. They work much more consistent than the normal RC servos, but they are also much more expensive. Most mechanical parts were laser-cut @ RobotGarden, a maker space in Livermore, CA. The `gripper glove’ was 3d-printed;-) Both of those things were not really available three years earlier. The FreeCAD drawings for all are included in the so_arm repository. The gripper itself is one pre-made part, the LynxMotion Little Grip Kit with the only RC servo in the arm.Arm2

The brain stem is a little  Robotis OpenCM 9.04 board with an adapted Arbotix firmware. The idea behind that little board was good, but it looks like there is not too much progress with the OpenSource Support:-( In 2013/14, there was some momentum behind it, but now it looks pretty dead. Why the Arbotix firmware? It makes the connection to the higher level Robot Operating System (ROS) very easy, in this case via a Serial-USB connection.

ROS is used in many different robots in research/education as well as in production environments. It brings many features for higher level control and can be adapted to new robots as needed. So this was a good way to explore it’s features. In the process, we learned a lot with the help of Patrick Goebel’s “ROS by Example” books😉  They show a lot in a `simulated environment’ as well as with real robots when you happen to have the right hardware. But we were able to adapt things to our arm as well.

The first idea was to use a Raspberry Pi2 as ROS computer. I use such setups for some driving rovers. But we quickly learned that the path calculations were too much for the Pi. So in the end, ROS was runArm3ning on a laptop with Ubuntu 14.04 which worked very well. If you watch the video above carefully, you see the model of the arm in RViz on the screen before the laptop turns the screen dark (on batteries).

The Arbotix ROS repo is cloned from the original with my changes and the CM firmware.

The SO_Arm repo contains all the other ROS source packages (some modified copies of the rbx arm packages) and the mechanical designs.

And the result of all that? A second place at the San Joaquin County event;-) The first place went to a `two arm, remote controlled setup’. But overall, we learned a lot;-)

As always, look to explore something new;-)

A little update: The thumbnail images actually hide some larger versions with extra notes. They are very hard to see on the little versions and I got some comments about that.

Over the lasspamt couple of days we saw a big increase in SPAM bugs and SPAM comments in a Bugzilla installation. After the initial rush to stop that influx and clean up the mess, I took some time to look around and try to find some help to fight that issue at the source. Basically trying to filter/reject those bugs/comments right at the submission. Unfortunately, I did not really find much  🙁

The next step was to look at the sources (thanks for Open Source Software 😉 and see how hard it would be to to add a classification setup on my own. Bugzilla has a nice setup for hooks, but unfortunately there were none that fit my purpose. So I decided to add my code right into the normal sources. It turned out, that the majority of the additions were limited to two spots in one file, after the normal validations for the bug creation and the comment addition. I made some more changes related to configuration of the new service and to the error handling/text. But overall, it was quite easy and quick 😉 Thanks to another piece of Open Source Software: the CPAN Net::Mollom module.

The bz_4.4.11.patch was done against Bugzilla 4.4.11 and the resulting installation was tested locally with some simple messages and a free Mollom account. It seems to work as expected, but I don’t yet claim a real-world deployment. That would probably cost some money depending on how large the installation would be.

An additional Net-Mollom.patch to the Net::Mollom sources allows it to use the proxy configuration from Bugzilla. I thought, this would make things easier if the installation would need a proxy to reach the Mollom servers.

This whole exercise was just an attempt to see how much effort would be needed to implement a service-based SPAM classification for Bugzilla. This blog uses Akismet to classify comments and I believe my code could easily be adopted for that or even any other service. The most important part was to find the right spots where all the information is easily available before anything is committed to the DB. I think, I found pretty good spots 😉

As always, have fun expanding you horizon 😉

Our swim season is almost over, so here another post about my CTS console experiments.

I tried to do two things for the scoreboard connection:

  1. Create a wireless link to the scoreboard.
  2. Understand the protocol enough to build my own example scoreboard.

So far, I was only partially successful.

IMG_20150717_114928_1024I know the link is running a RS-232 with 9600Baud 8-E[ven]-1. So that’s the first hurdle. My firmware for the 3DR telemetry radios should be able to handle that and it seems to work for a while. But eventually, the radios loose the wireless link and then wait a couple of seconds before re-establishing it:-( So the wireless link is somewhat jumpy so far:-( Of course, I needed a MAX3232 breakout board as well between the console and the radio, very similar to the link to the computer. But I had to add a 820Ohm resistor into the RS-232 receive side. Otherwise, the MAX3232 would get very hot:-(

IMG_20150717_105839_1024I also logged soIMG_20150717_105815_1024me of the transmissions from the console and I believe, I have a pretty good understanding of the used protocol. I was able to write a little Arduino Mega (or ADK) sketch to handle it and drive a little display and send the decoded strings to an attached computer for more interesting processing;-) I used a Mega because it has multiple hardware serial ports;-) I decided to use “Serial” for the connection to the computer and “Serial1” for the connection from the Colorado console. My sketch is here: ScoreboardEmulator.tar I used three of the Sparkfun four-digit 7segment displays, but I only drive eight digits and one colon right now. That would also be hard on an Arduino Uno or similar.

P1000673_1024Right noP1000670_1024w, the little display shows the Colorado scoreboard `0F’ channel but all channels are sent to the computer.

Using a different display setup, that Mega would be able to drive a complete ten+ lanes display;-) Sparkfun has 6.5″ digits with a storing driver board for about $20 each. You could probably find them even cheaper directly from China, especially when you want to build a 10 lane display which would need about 100 digits. I tested mostly with the older Colorado System 5 but the System 6 is working as well;-)

So, overall more to think about;-)

Have fun,

— Marco

P1000667_1024Today’s post is going into a somewhat different direction. I was a tech-dad for our summer swim team, the Tracy Tritons,  for maybe ten years now.

My first extension was a little Ruby on Rails application to publish the meet information quickly to all the parents on a local WiFi network and on the internet. I started that in 2008 and used it until about two years ago when we switched to Hy-Tek’s MeetMobile. The application is still working with Hy-Tek MeetManager 5 backups and the sources live @ my github account;-) But that’s actually not what I wanted to write about today;-)

About a month ago we had some problems with our ageing meet laptop. So I was looking at possible backup solutions. MeetManager 5 seems to run fine on my Windows 7 64. BUT I could not find any drivers for our USB-serial adaptor:-( Others on the web described different attempts with different drivers but nothing wanted to work.

I also know that we push the cable length of our serial cable with more than 150 feed.

So I started to look at alternatives.

P1000666_1024I’m also playing with some autonomous rovers, and there I learned about the wireless 3DR telemetry links. They are basically a serial connection over a long-range 915 MHz  link. You can find them cheaper on ebay and they have a nice open firmware;-) I know, that link is working fine on my Windows 7 64;-) So those looked like a good fit to what I was trying to do;-)

But there is one more hurdle, the Colorado Consoles do have real RS-232 ports, not the TTL-levels expected by the radios. So I needed one more building block. The Ti MAX3232 is exactly what I needed and you can get complete little boards on ebay;-)

With all the hardware components sourced, I was looking at the software side. The link between the timing console and the meet computer uses 9600 Baud 8-O-1. That Odd parity bit is not supported by the original radio firmware. So I had to adapt that a little bit. I cheated a little bit there;-) my modifications accept the parity bit and ignore it on the receiving side. The error correction over the wireless link is done as it was before with the [now] normal 8-N-1. On the transmitting side, I calculate the parity bit again and send the required 8-O-1 to the target;-) While that’s not officially correct, I believe, it should be good enough since much faster links over longer distances don’t rely on the parity bit any more.

My changed firmware with support for Even and Odd parity bits lives on github as well;-) If somebody wants to have fun, feel free;-)P1000665_1024

The link seems to be working OK for what I have tested so far;-) With one side on our living room floor, I could take the other side outside more than 200 feet away. Then there were more houses in the way, so I don’t know the maximum reach;-)

As always, take bits & pieces and combine them in new and exiting ways;-)

Have fun;-)

IMG_20150705_151534 IMG_20150705_151644This post is way late:-( First I got stuck trying to find or build a Fritzing part for my TSL235R light sensor. I tried to build the part in FreeCAD but that died a couple of times on me, so I got frustrated:-( I constructed other things with FreeCAD and had no problems, but it did not like that little part:-( Then, I had some problems with my WordPress setup, the backup scripts did not want to work and all the sudden it’s five month later than when I wanted to write this post:-(

The colorimeter was actually the first sensor setup I wanted to build for tests. It was the one, I had the least experience with before. The original costs more than $100: Vernier Colorimeter

My colorimeter is basically four light sources, one RGB LED which I use as three distinct LEDs in one housing and one of the near-UV LEDs and the TSL235R light sensor, all driven by the Arduino. I did play with the light sensor for a different project before, so I had some code already;-)

The TSL235R light to frequency sensor costs about three dollars @ sparkfun. The LEDs are pretty cheap when you buy them in larger quantities;-) I usually have enough of those on hand;-) You want to keep outside light out of your device and you want to limit reflexions around your sample, I just built a Lego box and lined it with mat black construction paper. You want some clear cuvettes for your test solutions and maybe some pipettes. Usually those are only sold in packs of 100+:-( I built a little template out of scrap plywood to get the cuvettes in the same spot for each test.

The Arduino code is pretty straight forward. For each colour requested, it turns on the LED at a specified level (calibrated to the particular setup), waits a bit, counts interrupts from the sensor for one second, turns the LED off and calculates the final value. That’s done ten times in a loop just to get more data points.Colorimeter

I tried this setup with different concentrations of fountain pen ink and it kind of worked. But I did not keep a record:-( and now everything is dried up:-( The sketch is here: Colorimeter.tar

That’s it for the 2015 Science Olympiad posts, sorry that this last one took so long. But maybe it will be useful again at some point.

As always, have fun exploring;-)