Friday, July 05, 2019

The Wharf Rats and the Hail Mary Mods at the Houston 2019 FIRST LEGO League Wold Championship

The Wharf Rats qualified for the FIRST LEGO League World Championship in Houston when they received the Grand Champion award at the North Carolina's FLL  State Championship - Track B.

I want to share a little of the real world engineering experience the team had in Houston. During practice rounds they saw new features (missions) break in new ways under new test conditions and had to respond to the new data. Fix a bug or delete the feature so you can ship the product? Their "ship date" was inflexible. So they learned that sometimes you have to delete features to move a project forward.

Their robot had a rough day during Wednesday's Practice Rounds (scored runs that do not count toward competition scores). Some fixes appeared to work but then they saw new failure modes in missions later in the run. The more they tried to fix it, the worse it seemed to get. The robot was score was just over 100 where it scored 192 at the state championship, and closer to 300 in practice sessions prior to Worlds. They were discouraged and stopped working on the robot before the pits closed at 4:30 pm. Instead they went to the party in the park, listened to the music, played games, danced and just had a good time.

When the party was winding down, I shared that it was a common programming practice to eliminated unstable features from a product to allow you to hit your ship date. So we talked about looking for a key failure point that might have the most impact on their total score. They picked Run 4's Strength Exercise mission whose failure impacted the most missions down the line. They agreed it would be better to eliminate that mission, and it's points, to improve the robot's reliability for missions that follow. But that would require modifying the robot, changing mission fixtures and updating the firmware (thing they worked on for months). Their robot and fixtures are locked up in the pit until 7 am the next morning and their first competition run is at 8:40 am. Time for a Hail Mary! No fear! 

This is engineering! A bug is found in late testing. Your project ships tomorrow at 8:40 am. You can start working on it at 7 am. Now fix it!


Here is the team at 7:33 am Thursday morning. Everyone is tired but ready to go. They are working on their robot with less than an hour before they need to be in the queue for their 8:40 am run. You can see the venue is almost empty (the practice boards do not open until 8 am).

They modified the robot's attachment to remove the mission being deleted, update software and signed up for an 8 am  practice table. They had time for one 10 minute slot to test the mechanical changes and dial-in the programming changes. After multiple corrections, the robot turned the wrong direction then started driving the wrong way, they finally got Run 4 to work ONCE before they had to run to the pit to drop-off the laptop and get in the queue by 8:30 am for their first run! Their 8:40 am run scored 250 which held on to give them 13th place in robot performance! Video linked below.

My favorite part of the run is the 180 degree turn at 1:51. The turn was needed because the robot had been aligning on the wall using the Strength Training fixture on the back of the robot that was deleted. The fixture that was removed left the back of the robot uneven, so the robot had to spin and do the wall alignment using the front of the robot. That also meant that the first mission after the wall alignment, 3D Printer, had to be updated to turn the opposite direction since the robot was now facing the wall rather than backing into the wall for the alignment.

And for a just a little while they they were at the top of the robot games leader board.

They also had a great research project (a system to reduce the deterioration of the human balance system during extended exposure to micro-gravity) that we hope to continue to advance. I could not be more proud of what they accomplished this season!

A great way to support FIRST is by volunteering as a coach, mentor or assistant! Teams can always use extra help with something. Find a team (or teams!) in your area and share your skills! Email me if you want help finding a local team. And contact me if you are interested in establishing an FLL program at your school. 


Coach - Wharf Rats - FLL #5027
Instructor - Summer Robotics Camp

Tuesday, July 02, 2019

Repair OVER SPEED Error on Generac 15 kW Generator

Note this is a follow up on the post linked below where we installed an external battery charger on this Generac generator. The Battery Tender we installed has been working well for over 4 years using the same battery that failed twice using the factory charger!

The most recent issue with the generator was a failure to complete its weekly self test. Upon inspection the OVER SPEED error light was on. You could still run the generator in Manual mode and it sounded like it was running normally.

My research indicated that, in addition to a genuine over-speed condition, this error can be caused when the sensor board doesn't have power so the sensor reading is not present, causing an erroneous Over Speed error. So I started looking for reasons that the sensor board might not be getting power. Let the sleuthing begin!

Danger Will Robinson! You should have a qualified generator service technician diagnose any issues with your generator. The voltage levels in the generator and associated switch gear are lethal. Forgetting to disconnect the power or touching the wrong spot at the wrong time can and will kill you. It is too easy to forget that you closed a breaker a few minutes ago. Really, have a technician do the work on your generator.

Safety first, this meant putting the generator in OFF mode and turning off the power to the house. Even then I pretend that every circuit is still live and avoid touching any conductors. Belt AND suspenders type of caution is the only way to go when dealing with electronics that can kill you!

When everything was off, I open up the generator's electrical panel and the transfer switch panel to look for obvious issues like disconnected wires, loose wire terminals and blown fuses. I got luck and found a blown fuse in the top of the transfer switch. There had been thunderstorms in the area shortly before the generator failed it's first weekly test. 

I ordered a pair of fuses, $7 each, and a $15 fuse puller/installer. The fuse were not cheap but I ordered two since there is at least a 50-50 chance that the fuse blew for a reason and the first replacement will blow again as soon as you power the unit back on. If that happens, then back to the diagnostics. I would start with again killing the power and checking the resistance between the fuse terminals and the chassis, looking for a frayed wire shorting against an edge somewhere.

Fuse on Amazon
Fuse Puller on Amazon

The fuses arrived quickly, thank you Amazon, and I repeated the process of turning the generator off and turning off power to the house. I then used the fuse puller to remove the old fuse and install the new one. To be honest, I also wore rubber gloves when working with the fuses. Never bet your life that a power circuit is actually off.

We reconnected the house power, set the exercise time and the generator ran fine. It has now been over a year since the fuse was replaced and the generator has not missed a weekly self-test. It has also automatically started several times during actual power outages. And we still have a spare fuse!


I am doing some early testing for a battery voltage monitoring system that I put together for this generator. Below is a graph showing the battery voltage during the generator's weekly exercise. Here you can see the battery voltage drop during starting, then the voltage begins to recover while the generator is running and then the battery is topped off by the Battery Tender before dropping back to the standby voltage. I can also configure the system to send me an email or SMS when the voltage drops below a specific voltage (generally this happens during starting so I am notified of start events). My goal is to be able to detect battery deterioration (and indicate that the battery needs to be replaced) before a failure to start occurs. It is also reassuring to see the battery charger topping off the battery following the weekly self test.

Wednesday, March 13, 2019

Minimal 3-Axis Magnetometer Rapid Prototype

This project started when a friend asked me to develop a method to measure the strength of a low-level magnetic field for a fixture in one stage of the playing field for a robotics competition. This was a college level event with teams from around the globe. The system used a low-level magnetic field so detecting the field was more challenging than simply using a reed-switch or hall effect sensor.

The design target for the magnetic field stage of the event was 1000 microtesla. To ensure fair competition, the event manager needed a way to verify all of the boards produced a field meeting or exceeding 1000 microtesla. I suggested a potential sensor, the Melexis MLX90393 Triaxis Magnetometer for calibrating the fields and was quickly asked if I could put something together. That is the ever present danger of tossing out an idea in a meeting, "That sounds great! Why don't you make that happen!".

It sound like a great opportunity to quickly assemble a minimal viable product (MVP) and share some rapid prototyping tips. Here is how I built the magnetometer used to validate the magnetic field generators for the IEEE Southeastcon 2017 Hardware Competition

One of the robot challenges required performing an action only when a magnetic field was present (there was a Star Wars theme for this stage so detecting the field was referred to as sensing "The Force"). The goal was for the robot to detect the field and mechanically tap the target to score and turn off the magnetic field. After a random time delay the field turns back on and the process repeats until the end of that timed stage. Tapping the target when the field was off would award negative points. The video below shows The University of Alabama on this stage. You can watch the whole video to see all of the event's stages.

"Sense the Force" Stage from The University of Alabama

There were many innovated robots on display at the event. Here are more videos from this and other IEEE Southeastcon events.

The MLX90393 was available from Sparkfun as a SparkX product (SparkX devices are early development boards made available to adventurous customers for early testing). Note that this breakout board is now availability as a regular Sparkfun product with the modular Qwiic connectors. Sparkfun also offers a full hookup guide to get you started with your own project.

I purchased a couple of SparkX boards, combined them with a Sparkfun Arduino Pro Mini and a Sparkfun Basic Serial board along with an OLED display on a bread board and got started. Below you can see all of the elements on a breadboard on my workbench.

I began with an example sketch, modified it to send the the data to the OLED, added a little text formatting for the display and the programming was done! Here is a link to the code that was hacked together from several sources.

Next up, the breadboard was fine for my workbench, but how should I package the magnetometer for travel and use on the floor at the actual IEEE event? This was a fast and dirty project so I did not want to design a case. I wanted something that was just good enough to meet my minimal requirements. A quick glance around my workbench provided the answer! At arm's reach was a Sparkfun box that fit the bill nicely!

It was quickly re-purposed to hold the sensor, display and power switch. It took only a few minutes to make holes in the box for each of those. By carefully cutting the holes as slits and keeping the fit tight, the flex and friction of the box held everything in place. I did cover the actual sensor with a layer of clear packing tape to provide some insulation since we were going to be placing the sensor up against the the metal head of the bolt used for the core of the electromagnet. The clear tape also made it easy to see the sensor to help ensure we were putting it directly over the head of the bolt.

The 18650 Lithium Ion battery is massively over spec for the use-case, but I had the battery and holders on hand so in they went! The breadboard and battery holder were attached with Velcro dots.

The device worked great in the field. We even caught when a few of the boards were wired (or wound) with the opposite magnetic polarity. Those boards were quickly rewired to ensure a level playing field for all of the teams.

I was impressed with the performance of the Melexis MLX90393. It could easily measure the change in magnetic field when a neodymium magnet is rotated 15 cm from the sensor.

This is one example of how you can quickly assemble a proof-of-concept prototype to test an idea or even provide a Minimum Viable Product for initial field testing. I hope this helps you with your prototyping!

Saturday, January 19, 2019

Building a Lightweight Folding LEGO Sumo Bot Practice Board

Here is an easy to build, lightweight, folding LEGO Sumo Bot practice board. Note that this board is NOT suitable for competition because it does not meet the requirements for the board dimension in the rules and does not provide a drop from the edge of the board to the floor as seen in competition. However, it is super light, easy to carry in one arm and can fit in any car. It provides a great platform for testing your robot programming and sensors in preparation for a Sumo bot event.

Our first effort at testing a Sumo Bot was actually putting black electrical tape on a table for the robot to detect and stop and then turn around. We figured we could change the Light Sensor thresholds from Black to White before the competition. We quickly learned to be ready to catch the robot when it ran off the table! That got old quickly so we wanted a better solution. So we came up with a folding practice board described here.

Folding Sumo Bot Practice Board

The board is made by simply using white tape to add a border to a black tri-fold poster board (I like foam-core if you can find it) and drawing starting boxes with a marker. I used 2" white masking tape on a foam core 36" x 48" tri-fold. The boxes were drawn with a gold Sharpie marker. We tried a silver Sharpie but it triggered our robot's light sensor, causing problems when traversing the board.

The size and location of the starting boxes are the only items here that follow the official rules. But these are the most important requirements because they accurately define the only time in the match that you will know the location of both your robot and your opponent's robot.

The dimensions and placement of the boxes came from the Watauga Rules linked below. We actually cut a cardboard square the size the starting box and centered it on the center panel. Using the orientation of the image above, we traced just the top and bottom sides of the cardboard square which will be the bottom of the top box and the top of the bottom box respectively. This step ensures the starting boxes are the correct distance apart. Then we added the other three sides of each square to produce what you see above.

The placement of the tape is not that critical. We start with a strip at the top and bottom of the center section, stopping at the fold line. Then we added the four angled pieces before finally added the lines on the left and right ends to finish up the frame. While it is not a circle, it still provides an effective test platform for the robot.

Sumo Bot Events

LEGO Sumo Bot events offer competitors a chance to design, build and program a LEGO MINDSTORMS robot to compete head to head with another robot. I have coached in FIRST LEGO League for several years and my students have enjoyed participating in Sumo Bot (and LEGO Line Follower) events. The single day events do not require the extended effort needed to compete in FLL and let the students enjoy the head-to-head competition. It is also nice for the students to have a simple goal that allows them to quickly test different mechanical designs and programming strategies.

The events we attend follows the Watauga Sumo Bot rules as shared by Dr. Eric Marland at Appalachian State University in Boone, North Carolina. The link below has information for their Sumo Bot program. Other events may follow different rules but most are similar. 

Here is a link for the Watauga LEGO Sumo Bot Rules for 2019 (unchanged from 2018).

Note that many events also offer an "Open Category" that allows robots with non-LEGO components. I expect this practice board would be helpful for them as well. 

Sumo Bot has a simple premise, after a 5 second delayed start, your robot leaves the 10" starting square and then works to push the other robot out of the Sumo Bot ring without your robot leaving first. The action is made more interested because the ring is generally elevated slightly from the floor and a robot is officially out of the ring when any part of the robot touches the floor. This includes parts that fall off of your robot (if a piece touches the floor, you are out). 

Note there are some great instructions online for building a real Sumo bot ring, the kind you will need if you are going to host an actual LEGO Sumo Bot event (in fact you will probably need at least two or three boards to keep an event moving). But official boards require materials, tools and time to build them. In addition the boards are very large (77 cm across) and heavy, making it a hassle to move them from room to room let alone try to transport them.

Practice Board in the Pits

We take our practice board to the pits at events for use if the students need to test tweaks to the software or verify calibration of the light sensors. It also provides a great platform for demonstrating the robot's behavior or even doing some friendly scrimmages before the event starts. Most events include practice rounds but you must sign up for specific time slots. 

Each spring, Triangle Math & Science Academy holds both a LEGO Sumo Bot and LEGO Line Follower event. I recommend these for students who want to improve their LEGO MINDSTORMS building and programming skills.

Both events are fun and each offer k-5th and k-8th brackets and each bracket has it's own competition ring (or line following field for the Line Follower). Typically they matches in both brackets at the same time. Below you can see one of our team members setting up for a run. Notice how the official Sumo Bot board is larger and is elevated from the floor. 

I hope this information helps you build a great practice board and get a chance to participate LEGO Sumo Bot event!

Thursday, October 25, 2018

Roasting Coffee with a Hot Air Poppcorn Popper

There are many methods of roasting your own coffee. In fact,  roasting your own coffee on an as-needed basis using a stove, oven or fire to was common until relatively recently. I have used several machines for roasting coffee at home. Today one of the fastest and easiest methods of roasting coffee is using a hot-air popcorn popper and the method I use most often myself (although I have purchased two dedicated roasting appliances over the years). Here I will share some details about the roasting set up that evolved over almost 16 years of recreational coffee roasting.

The Beans

Today's roast is Timor Leste Lacao Village from Sweet Maria's. They are my favorite supplier of green coffee and a great source of information about roasting and the history of coffee.

The Roaster

My current roaster of choice is a donated vintage popcorn popper that has worked well for several years. Often poppers are available in thrift shops. If you ask friends and family I expect you will find someone who is happy to give you one that has been sitting unused in the cabinet for years.

I have had the power switch fail on a couple of poppers over the years. Now I connect the popper and cooling fan to a switched power strip so I can turn them both off and on at the same time. In addition to eliminating the popper switch as a failure point, it also saves the hassle of wrestling the popper looking for the switch. One detail I like about this popper is the open-topped discharge shoot that works well with the vent used in my setup.

Roasting coffee produces chaff (a piece of the parchment-like wrapper that comes loose from the bean during roasting) and smoke and keeping both of these under control makes roasting much more pleasant. My approach is to keep the popper a box with a top-mounted vent connected to a bilge blower that exhausts through an insulated panel installed in a window in my garage.

Power for the bilge blower comes from an adjustable power supply on my workbench. By turning down the power to the blower and slightly closing the flaps on the box, I can improve how quickly the roaster warms up during cold weather. It is no fun waiting for a slow roast to finish in an unheated garage.

Automated Control Options

Without hacking into the electronics of the popper, this setup still offers two clear options for automated control. The first option is to use a hobby RC servo to control a vent (flap or sliding window) on the side of the box. The idea is to close the vent until and operate the roaster in the sealed box until the interior temperature of the box reaches a specific threshold (100 F?) to get the roast started quickly, even in cold weather.

The second option would be to add PWM control of the blower to run at be off or run at low speed until the temperature reaches the desired threshold. Again to help the roast comes up to temperature quickly in even the coldest temperatures while still ensuring the fan is on to vent smoke and chaff outside once the roast gets going. 

Roasting Technique

I start the popper and pour green beans into the chamber until the beans just stop swirling (maybe just a little extra). I will then give the roaster a few shakes (it might take a minute) until the beans are swirling on their own. The goal is to use as much coffee as the popper can circulate.

The bean will go through many stages during the roast. Where you stop the roast depends on the type of bean and the degree of roast that you want. The article below outlines the differences between the stages of roast.
Stages of Coffee Roast

As the beans warm the coffee beans will begin to change color and begin losing some of their chaff. As the beans begin to roast you will hear a popping sound, the first crack, and the chaff will come off of the beans very quickly. I like to stop the roast when the first crack has just finished. This is generally described as a City Roast. For this batch, I stopped the roast at a little under 6 minutes.

I feel most coffees reach their peak of flavor between the end of the first crack and the very start of the second crack. If you want to roast past City Roast the quickness of your cooling method becomes more critical as the roast begins to be exothermic and can coast for some time after being removed from the heat. If your cooling is too slow it is very easy to overshoot and get a darker roast than you intended.

Cooling the Roasted Coffee

I cool the roasted coffee by dumping into a wire mesh colander setting on a fan aimed straight up. I found that cooling time can be shorted by bending a dome into the bottom of the colander and using a little painter's tape to direct the airflow inward. With this set up the beans are cool to the touch in less than two minutes.

The dome keeps the beans away from the center of the fan that has low airflow. Before the dome, I had to shake the beans around to ensure even cooling. 

This batch yield 116 grams, or just over 4 ounces, of roasted coffee. The beans get lighter as they lose moisture and volatiles during roasting so this probably started out as close to 5 ounces of green coffee.

I usually do at least two batches of whatever I am roasting. This usually means two batches of caffeinated and two batches of decaf. This is just the right amount to fill the jars that I like. Coffee brewed with beans fresh from roasting tastes great to me but many types of bean will improve in flavor with a rest of 6 to 48 hours.

If you would like to try roasting yourself, I recommend starting with a hot-air popper and coffee sampler from Sweet Maria's. Try the half-decaf bundle and you may be surprised at how good decaff coffee can taste. My favorite everyday coffee is half decafintaed Indoneasian and half caffeinated Yeman or Ethiopean. I also like having decaf on hand for the occasional evening cup of coffee.

Hot Air Popcorn Popper

I hope you have learned something that helps you improve your coffee roasting.

Tuesday, September 26, 2017

Research Links on Weight Loss, Nutrition and Fasting

I began researching weight loss approaches and fasting in particular in early 2017. Here are some links for the sources that I found most informative. I used periodic fasting (ranging from not eating until dinner time all the way up to having a meal Sunday evening and not eating again until dinner on Friday). 

I lost 40 pounds (and have kept it off for close to three years). I also used fasting to help improve my concentration when studying for and taking the USPTO Patent Bar Exam (I passed!)  I hope you find this information helpful.

Novel study (super controlled and reversing test/control subjects) on Ultra-processed food.

Full text of the study of Ultra-processed diet.

Forks over knives article on fasting

Experiments in intermittent fasting by an athlete who is already in great shape and eating well.

An interesting paper on metformin impact on blood sugar and weight loss

Dietary restriction with and without caloric restriction for healthy aging

Health Impacts of Calorie Reduction

Fasting Weight Loss Paper

Investigation of Starvation Mechanisms

Why fasting bolsters brainpower.

Why does fasting boost learning?

Intermittent Fasting and Weight Loss

Write up about a supervised 382 day fast, the patient lost 276 lbs.

A History of Modern Research into Fasting, Starvation, and Inanition

Interesting fasting information collected from several reference sources

Good video with links for references on Longevity and eating one meal a day.

Is Ketosis Dangerous?

Fasting versus eating less.

We should never have told people they could 'burn off' calories with exercise.

Where does the fat go when you lose weight?

Cancer cells use glucose for energy to build with amino acids

Effects of Short-Term Fasting on Cancer Treatment

University of California San Francisco - Cancer and Fasting/Calorie Restriction

Fasting in Oncology: A Word of Caution