Octoprint now supports JamSentry

I finally stopped using Windows to drive my printers after the 3rd time it did an update and restart in the middle of a 12 hour print.  So I am now using Octoprint to drive the printers.  I developed an Octoprint plugin to support JamSentry.  It also provides the JamSentry status in a convenient tab so you don’t have to have it as a separate webpage.  Info on the plugin and installation can be found here.

JamSentry is a small DIY device to detect filament jams and filament runout conditions.  It does not require any printer hardware or firmware changes.  This plugin allows Octoprint to take action when a jam is detected.  The JamSentry unit itself has not changed and info on how it works and how to make one can be found here.  Everything is free.

Happy Printing!!!

Detecting 3D Printer Jams and Filament Runout Conditions

I do a lot of 3D printing as part of my prototyping work.  One of the most annoying facets of 3D printing I had was filament jams.  A printer will be working fine and then mysteriously start jamming.  And since there are several possible reasons, it can be a pain to troubleshoot.  In many cases, since these are only prototype parts, I could have rescued the print had I known about the problem.

There is also the annoying end of filament problem where you keep waiting to use the last bit of filament before changing the spool.  This is filament runout.

I looked into solutions, but they generally required changes to the printer firmware or had to be activated each time a print was started.  I wanted a better way.

So I developed the JamSentry.  It can be made from commercially available parts (except for a small custom circuit board that can be obtained quite cheaply).  I am releasing the designs to the community for private, educational, and non-profit use.

It is a device for detecting printer jams and filament runout conditions.  In the pages linked to this blog, I will tell you how to make one for yourself.  Best of all it requires no changes to the printer firmware, works automatically (no starting it up each print),  should work on any printer (direct drive extruders or Bowden), and works on dual (or more) extruder heads.

The JamSentry has the following features:

  • Can emulate a filament runout switch when a Jam or Filament runout condition is detected.
  • Can pause the G-Code sender program when a Jam or Filament runout condition is detected. (requires changes to the G-Code sender program)
  • Can alert the user when a Jam or Filament runout condition is detected (uses IFTTT webhooks, so the alert can be received as an e-mail, SMS, app notification, blinking lights, whatever)
  • Can alert the user when the print job is done.

Information on how to make one is here.  The 3D printed parts are here.  The software is here.  The custom circuit board is here (the only thing you can’t buy off the shelf) and you can order 3 of them for less than $5 with shipping included.

If your interested in manufacturing this device, then please let me know.

Happy Printing,

Stephen Hayes of RoboGardens


How to Build the Autotester

I have gotten a lot of positive feedback on the autotester and a new version is available.  Instead of printing some of the large parts, extruded aluminum is used.  The 3D parts can now be printed on printers of 150mmx150mm build size.  The STLs have now been uploaded (here).  The PCB design can be found here.  The software can be found here.  Detailed info on how to build one can be found here.

Automated Water Testing


Hydroponics, aquaponics, water features, aquaculture…  A lot of endeavors depend on water quality and knowing what is in your water.   You can automate testing of a few things, but for many things sensors either don’t exist or are prohibitively expensive.  Many tests can be performed using colorimetric tests where one or more reagents are added to the water and the resulting color is the indicator.  But these can be time consuming to perform.

I got tired of being bitten by mosquitoes while waiting for the Nitrate color test to complete and decided to automate the process.  I built the autotester which can be used to automate the API tests or any other colorimetric tests that use liquid reagents.

There are 12 slots for reagents.  The reagents are in 10mm syringes which can be popped in and out.  The tester can perform the following steps:

  • Rinse and clean the mixing tube
  • Fill the mixing tube with x ml of water
  • Agitate the reagent before dispensing (if needed by the test)
  • Dispense x drops of reagent into the mixing tube
  • Dispense whatever combination of reagents is needed by the test
  • Agitate the mixture (if needed)
  • Wait for the color to develop
  • Compare the resulting color to recorded color swatches (the CIElab colorspace is used since it was designed to mimic human color perception)
  • Stopper the reagents to preserve them between tests
  • Record and report the results
  • Run tests on demand or by schedule
  • Send notifications where the readings exceed preset thresholds
  • Send notifications when a reagent is getting low

Tests sequences are set up using a web interface.  To learn the color values associated with a test, the color swatches can be placed in front of the camera and it will record the color values and the associated test reading.  For maximum acuracy, the tests should be run with the cover on and lighting only supplied by the internal LEDs.  The system also samples the lighting environment and attempts to adjust to alternate lighting environments should the tests be run without the cover on.  Unlike humans, the autotester is very precise in reading the color.  It can interpolate between colors and extrapolate beyond the end colors to obtain more detailed measurements than the human eye can achieve.

The processor is a Raspberry Pi (model 2, or 3, or Zero) and a custom circuit board is used to control the steppers, electromagnets, lighting, valves, and pump.  The camera is a pi-camera with a fisheye lens.  The plastic parts are 3D printed.  In this case it is important to print most of the parts in white or black as you do not want to bias the color measurements.  The designs and code will be released open source once the web interface is cleaned up to be more user friendly.

The video below shows the autotester in operation.

More info on building the autoTester can be found here.


A Better Fish Feeder

A Better Fish Feeder

I was unhappy with the automatic fish feeders that I found on the market. They are all examples of bad automation.  They work just well enough to instill a false sense of security, and they they break in often catastrophic ways.  At best, they just stop working and the fish get hungry. At worst they dump a full hopper of food into the fish tank and the fish may die.  In addition, they do not adapt to conditions so they may either continuously over or under feed the fish.

So I built a better one.  It is a smart fish feeder.  The feeder does not dispense a fixed amount of food on a given interval.  Instead it observes the feeding. Using a camera and vision processing algorithms, it watches for signs that the fish are satiated.  Those signs can be decreased feeding activity, uneaten pellets, or the fish simply not showing up to eat.  The feeder stops feeding when it detects these situations (or after a preset maximum amount of food has been dispensed).

Additional sensors are also used to monitor the environment.  A temperature sensor monitors the temperature of the water.  Feeding can be adjusted based on water temperature and may be cutoff beyond certain limits.  The water level is also monitored.  This is used in determining the size of the camera field of view, but can also be used to alert the user if the water level in the tank is either too high or too low.  Lighting is also built in that can be used to illuminate the feeding area at night or in dark tanks.

The feeder can also alert the user of situations like out of food or a feeder jam.

Plus, you can watch and feed your fish from the comfort of your house or when travelling  :).  One nice feature I have found is that you can feed the fish manually whenever you like without having to worry about the automatic fish feeder dumping more food into the tank later.  The feeder observes that the fish aren’t hungry (or even that there is food already in the water) and aborts or shortens the feeding cycle.

As you can see from the attached feeding log, the system will often stop feeding because either the fish are not active enough or there are pellets left in the water.

2017-07-21 13:00:12,444 – Feeding Started: Type is AUTOMATIC
2017-07-21 13:00:12,448 – Dispensing – Release#: 1, Auger revolutions: 0.25
2017-07-21 13:03:01,447 – End of observation pellet count: 2
2017-07-21 13:03:01,460 – End of observation max fish activity: 122.610276094
2017-07-21 13:03:01,463 – Dispensing – Release#: 2, Auger revolutions: 0.25
2017-07-21 13:05:50,022 – Dispensing Terminated due to uneaten pellets – Pellets found: 9
2017-07-21 13:05:50,025 – Max fish activity: 92.6485367965
2017-07-21 13:05:50,027 – Feeding Terminated
2017-07-21 13:05:50,031 – Dispensing Ended 
2017-07-21 18:00:11,794 – Feeding Started: Type is AUTOMATIC
2017-07-21 18:00:11,807 – Dispensing – Release#: 1, Auger revolutions: 0.25
2017-07-21 18:03:00,467 – Dispensing Terminated due to uneaten pellets – Pellets found: 5
2017-07-21 18:03:00,470 – Max fish activity: 45.2194574315
2017-07-21 18:03:00,474 – Feeding Terminated
2017-07-21 18:03:00,477 – Dispensing Ended
2017-07-21 20:10:33,092 – Feeding Started: Type is MANUAL
2017-07-21 20:10:33,105 – Dispensing – Release#: 1, Auger revolutions: 0.25
2017-07-21 20:13:22,181 – Dispensing Terminated due to uneaten pellets – Pellets found: 8
2017-07-21 20:13:22,185 – Max fish activity: 69.4196517557
2017-07-21 20:13:22,206 – Feeding Terminated
2017-07-21 20:13:22,209 – Dispensing Ended

Status of the Project

I have been using the prototype systems to feed my fish for about a month now.  I am impressed by how well it works.  Although I have applied for a patent, my intention is to make it available for personal, DIY, non profit, and educational use.  The plastic parts are 3D printed and the electronics are all readily available. The processor is a raspberry Pi Zero W which costs about $10.  The most expensive part is the camera which costs about $30 due to the need for a fisheye lens (so you can observe a larger area).  My intention is to release the 3D models, the code, and the PCB (Printed Circuit Board) design as open source. The 3D printed parts require a large format printer and probably close to 2 days printing time.  Installing the software is also challenging as it requires many heavy duty vision processing and machine learning libraries such as opencv and dlib.   I suspect it is a more challenging build than most people will want to undertake.  So if anybody has an interest in turning this into a product, please contact me.  With a little bit of design work, the system could be miniaturized to work for home aquariums.

Here is a list of things that are working and not yet working:

  • Feeding based on fish activity or uneaten food  – Done
  • Video streaming of the camera output – Done
  • Distinguish between fish food and stuff that looks like food on the bottom of the tank – Done
  • Maintain statistics on fish behavior and food consumption – Done
  • Maintain statistics on water temperatures and water levels – Done
  • Alerts if the fish are unexpectedly not eating – Done
  • Alerts for conditions like water temp out of range, water level too high/low, feeder empty – Done
  • Expand the training to cover more types of food – In progress
  • Test the system with different types of tanks and different lighting conditions – To be done
  • Slick web interface – To be done
  • Automatically learn the food pellet shapes (works with round pellets currently) – To be done
  • Improve speed of image processing – To be done eventually, there is only so much you can eek out of a raspberry pi zero.
  • Capture portal for configuring the WiF network – To be done
  • Watch for anomalous conditions like dead fish – To be done
  • Supervisory heartbeat so you will be alerted if the feeder stops working – To be done

The feeder communicates using WiF.  If you have a WiF network in place, it can connect to that.  If not, it can act as the WiFi host.  Without internet access, the system will work fine, but of course you will not be able to access it remotely to control it or view fish activity.