That’s a Wrap (for now) Ladybug Shield Beta 2


, ,

 Ladybug Shield Works – Open Source Available

Totally a YIPPEE! moment.  All circuits on the Ladybug Shield are working.  pH and EC values get reasonable measurements.  Pumping works.  WooHoo…

IMG 3409

Just back from OSH Park

IMG 3417

Check out the Awesome soldering Job Thanks to the Zallus Reflow Oven Controller

IMG 3415

Ooh—OOH – IT WORKS!—time to work on enclosures…

Open Source

Arduino and Kicad files are located at this GitHub location.

Thanks to Those That Went Before

I would not have the skills to do this without the teachings and mentoring of Chris Gammell and his Contextual Electronics courses.  There was A LOT to learn (still is of course).  Chris and his courses greatly accelerated the process.

Regarding skill, thanks to Ryan (SparkysWidgets) for open sourcing the minipH and miniEC.  The EC and pH designs of the Ladybug Shield evolved from Ryan’s work.  Besides that, Ryan has been super helpful.

A terrific company that has provided an invaluable service and EXCELLENT support – OSH Park.

A very useful reflow oven controller from Zallus.  Works GREAT!  My soldering skills skyrocketed with this addition.




Wow.  I think that’s a wrap for the Ladybug Shield….I’ve started using them….a total YIPPEE! moment.


What’s the Challenge with the Zucchinis?

I recently transplanted some Zucchini seedlings to one of the cold frames in our backyard.  It looks like the newer leaves are more yellow than they should be…or at least what I think they should be…

IMG 3404

I’m thinking there is either a difficiency in Nitrogen or Sulfur.  Since I am not sure which, I decided to fertilize with 2.3mS of magnesium sulfate.

IMG 3408

This should let me know if the yellow coloring is due to a lack of sulfur….hmmm…or magnesium.  

I have a ways to go before I can look at a plant and diagnose the deficiency…until then I will try then try again.

But…someone on reddit noted:

Liquid fertilizers burn new roots and young plants. They’re basically chemicals that “burn” until they settle in the dirt to be extracted by roots. Too much of it is a bad thing. I highly recommend earthworm casings.

 This is great stuff!  So much to learn.  In a fun way.  From observing and adjusting.  …and eating!

Ladybug Measure – Auto Nute Measuring Device


A roadblock in hydroponically growing plants is feeding the correct ingredients at the concentration preferred by the plant.  The ingredients and concentration will vary depending on plant type.  I want to build an experience that automatically measures the ingredients.  For the prototype, I will focus on leafy green plants like lettuce, cucumbers, and tomatoes.  By not trying to measure chemistry for any hydroponically grown plant I will have more time to focus on the end-end experience.

The Goal

The goal of this post is to put down initial project definitions of what I’m calling – at least for now – the Ladybug Measure.

Thanks to Those That Went Before

Thanks to Ben Krasnow for posting his work on the Cookie Perfection machine.  A lot of my design thoughts come from watching Ben’s videos.  What a fantastic project with delicious results.

Thanks to Chris Gammell for pointing me in the direction of Ben’s work.  And of course for the excellent Contextual Electronics courses.  It’s exhilarating to take his courses and feel more like an apprentice to a master.  It is a great way to learn electronics.

What Ladybug Measure Does

The Ladybug Measure device will solve the challenge of measuring out the correct chemistry to hydroponically grow different types of plants.  The home farmer enters in the type of plant – say “Lettuce”.  The Ladybug Measure measures out the different dry ingredients into a container.  “Just add water” is the next step for the home farmer (hopefully RO water! :-) ).

High Level Design

I plan to evolve the design Ben Krakow used to build his amazing cookie machine.  The Ladybug Measure will be easier because it handles only dry ingredients versus the cookie machine which deals with hard to automatically measure stuff like brown sugar and butter.



Ben’s Cookie Machine Project

I like the “lazy susan like” approach.  So I’ll start with that design.  The Cookie Machine uses smaller quantities of dry ingredients.  I plan to use a funnel, but it will be bigger.  I’m not sure how much bigger.  The home farmer enters into a smart phone app that talks to Ladybug Measure over BLE.  I’ve started to use BLE and my iPhone for device UIs since I find the experience painless to create and use.:

  •  the plant to be fertilized. 
  • the gallons of water.
  • the smart phone app connects to an Arduino with BLE that is identified as a Ladybug Measure device.  It gives the command “please measure out ingredients for 1 gallon of fertilizer.”
  • Ladybug Measure moves one of the dispensers over the bowl.  The dispenser releases “just the right” amount of ingredient it holdsthe needed measured amount. so that the funnel will add some of the compound its holding into the bowl on the scale.

How Many Dispensers?

The short answer: 6

The longer answer…why?

Pasted Image 4 8 15 2 42 AM

Really Big Dispensers…Labels Discussed Below

As noted in Fertilizer Management for Greenhouse Vegetables (Vol 3)  there are 16 elements needed by all plants:

The 16 elements required by all plants are carbon (C), hydrogen (H), oxygen (O), phosphorus (P), potassium (K), nitrogen (N), sulfur (S), calcium (Ca), magnesium (Mg), iron (Fe), boron (B), manganese (Mn), copper (Cu), zinc (Zn), molybdenum (Mo), and chlorine (Cl).

…The nutrients N, P, K, S, Ca, and Mg are referred to as the macronutrients because they are required in larger quantities by the plant compared to the remaining elements. The other seven elements are referred to as micronutrients because they are required in small amounts, usually a few parts per million (ppm) in the plant tissue.

This would lead to a conclusion that I’ll need 16 dispensers….but wait…I’m going to cheat a bit.  MHPGardener has a youtube video on making nutrients for tomatoes.  He blends three compounds together:  CHEM-GRO TOMATO FORMULA 4-18-38Calcium Nitrate (CaNO3)Magnesium Sulfate (MgSO4).  I tried this blend and have been very pleased with results I have seen on my tomato plants.

I’ve decided I need a minimum of four dispensers one for each of the three compounds above and one other blend similar to the Chem-Gro tomato formula, but for leafy vegetables – CHEM-GRO LETTUCE FORMULA 8-15-36.

This prototype will support 6 dispensers.  Each dispenser holds at a minimum of 8 oz.  Slightly larger dispensers could be used.  I figured out the dispenser size based on a spreadsheet I made on Google docs (GitHub link) that determines the amount of ingredients needed given the type of plant and the amount of nutrient bath.

I imagine over time the amount of ingredients will grow.  For now, this should be perfect for the prototype.


That’s all for now.  I’m very excited to start on this project.  I am sure to learn a lot.  Also – I just got notice from OSH Park that Ladybug Sheild beta 2 boards are in the mail.  I should get them tomorrow.  YIPPEE!!



Thank you for reading this far.  Please find many things to smile about.




Building an LED Light Source to Grow Lettuce with the Other Mill

Time to get back to building the constant current driver for the LED set up I discussed in this previous post (LEDs) and this post (constant current circuit design).  I am going to use my Other Mill to get to a PCB that I will then solder on parts using my reflow oven.  Whoa – talk about the treasure chest of toys I have built up!

When I last discussed the Other Mill, I have evolved my learning thanks mostly to the exceptional support and care I got from Other Machine.  I was having a challenge with my machine  – the Z-axis screw seemed jammed.  This had the unfortunate consequence of making a very loud grating noise after which whatever end mill was up for use was immediately broken by the Z-axis grinding too hard.

I admit a part of the challenge was my lack of milling knowledge/experience.  Regardless of what CNC machine used, as with other sophisticated hardware that makes things (my mind goes to a sewing machine), there is a base knowledge that includes what not to do as well as what to do when making a PCB.  It is an unfortunate consequence of my lack of networking/community that I did not know anyone who would show me ropes.  I bet with enough effort I could find someone.  But then – I also like to figure stuff out as I try it.  The challenge with trying stuff when clueless is I’m exploring an expensive machine that is not easily replaced if I blow it up.

On to the PCB.

Open Source

The automator workflow I used to rename the kicad files so they work with Other mill can be found at this GitHub location.  The Kicad and Gerber files are located here.

Foot prints

Before milling, I needed to finish matching foot prints to the components on the schematic.  In kicad this means I needed to finish the netlist from within the cvpcb tool.

Heat Sink and Mosfet

The image and layout below from the heat sink’s data sheet (I am using the 5073) shows the placement of the heat sink/mosfet as well as the foot print of the heat sink:


the mosfet’s has a TO-220-3 footprint.  Here is an image from it’s data sheet:


…and here is an image of the foot print I made in Kicad’s foot print editor:




The next one was the POT.  I am using this POT:


The foot print is included as part images on the digikey page:



Here’s the layout I used:


I tried to keep the spacing between tracks and components large enough so that the larger end mills (in this case the 1/32”) can be used.  

Feeding Files to Otherplan

The Otherplan software has native support for Eagle, but not Kicad.  This means features like the nifty DRC end mill clearance check aren’t available for Kicad.  There is one additional step I have to do which is to rename the Gerber and drill files from:




While I probably should just right a bash script, I ended up using the Mac’s Automator app to create a renameGerbers.workflow.  Unfortunately, Automator does not support wildcard matching which I use to rename the base name.  I ended up adding this Automator action to my copy of Automator.  Luckily, instead of trashing my hard disk (so far) it works as advertised – allowing me to create a workflow that uses wildcards when renaming the base name.  I also added an Automator action to rename the edge cut layer (i.e.: the outline layer) from .gbr to .gko.  AND it actually got rid of the .gbr instead of renaming the extension .gbr.gko  .  This unfortunate double extension happens when I was renaming the file using the Finder UI without File/Preferences/Advanced Show all filename extensions checked – which is not checked by default.

Setting up the End Mills

The software allows three end mills to be used during milling.  I kept running into an unfortunate bug.  Instead of figuring out what can be optimally cut out with each end mill, it will use the smallest end mill to do all the cutting.  I had an earlier attempt where I told Otherplan I had 1/100 1/64 and 1/32 end mills.  The directions Otherplan gave to Othermill was to use the 1/100 to cut out everything except the drill holes.  

Thanks to Simone, I had a way around this:

  1. Load your biggest tool by itself in Otherplan and in the mill, and run the plan. The biggest tool will take away most of the copper you want removed.

  2. Remove the larger mill from the machine, and install your next smallest tool. In Otherplan, leave the largest tool in the plan, but add the tool you just installed in the machine. The pla file window should have a 1/8” and, say, a 1/32” selected.

  3. Run the plan again. The machine will start with the 1/32”, and when the small tool is done will prompt a tool change. Click on Cancel to stop the job completely.

  4. Install your next smallest tool in the machine. in Otherplan, remove the largest tool, and add the smallest tool, so you have the 1/32” and the 1/100” in the plan file window.

  5. Run the plan again. It will run the 1/100”, then prompt the a tool change. Cancel the job completely.

This seemed to work.  Now the larger end mill cuts as much as it can before using a smaller one.  Much nicer.

Finally, the PCB

IMG 3401hmm…a bit blurry…but it shows the milling worked pretty well.  I ran into a challenge with the edge cut file.  It turns  out the edge cut Gerber I used for this milling was not a completed square.  One of the corners leaked.  This caused the Otherplan to ignore all the Gerbers and drill files.  I ended up deleting the edge cut Gerber and letting Otherplan figure out the outline.  Afterwards, I went back to see what the problem was and indeed – after deleting the outline and creating a new-and improved-outline, all files were read by Otherplan.


Time to solder on the components and see if the PCB works…


Thanks for reading this far.

Please find many things to smile about.

Ladybug Shield Beta V1 – Cleaning Up the Design


I finished testing the Ladybug Alpha V2….for the most part all works.  Still there is more to fix.  I just sent Beta 2 off to OSH Park.  I skipped Beta 1.  I had done a version where I had removed the pump circuits.  I decided to put these back in after testing the pumps.

The Goal

The goal of this post is to document changes to Ladybug Alpha V2 that change the schematic and layout.  

 Thanks To Those That Went Before

  • Thanks to OSH Park for their exceptional PCB fabrication and support.  OSH Park is excellent at keeping customers happy.  OSH Park – thank you for your exceptional support and company culture that makes me want to support you as a company.  Thanks to’s interview of Laen – OSH Park’s CEO – I now know that it is OSH and now Osh.
  • Thanks to Adafruit for their excellence in support, tutorials, and open source availability of schematics/layout.  This post borrows the design for a single power source in Adafruit’s motor shield.  Adafruit has done an excellent job not only selling to, but supporting and caring about customers.  I know when I have a question and post it on the forum – one of the incredibly knowledgable and kind folks (typically Mike or Bill) respond in a small amount of time – along with great answers from folks that are not employed by Adafruit.  Adafruit – like OSH Park – are high on my list of companies to buy products from.  The products are of great quality, come with excellent additions – like libraries for Arduino programming, tutorials, and are well supported.
  • As always, thank you to Chris Gammell.  I am continuing to learn A LOT from Chris’s Contextual Electronics courses.  I like the new format where we work on smaller projects together.  Each one has given me many opportunities to strengthen my knowledge…well, I try anyways.
  • Ryan of SparkysWidgets fame has a great product in his minipH and miniEC.  I recommend these break out boards.  It is what I evolved my designs from.  Thank you for your open source schematics and Arduino sketches.  Ryan is extremely helpful and kind.   Thank you.

Open Source

The Kicad files for the Ladybug Beta V2 are located at this GitHub location.

Beta 2 Changes

Changes from Alpha 2 to Beta 2 include:

  • changes to how the components as well as the pumps get power.
  • removal of temperature readings.
  • addition of test points.

The Power Design

The current design:

  • includes a voltage regulator between the Arduino’s VIN and the 5V used by the pH and EC circuit.
  • assumes two power sources.  One for the pH and EC circuit (5V) and one for the pumps (12V).
The Ladybug Shield Beta 1 will clean this up, removing the voltage regulator and the need for two power sources.  The design will borrow from Adafruit’s power source on their motor shield.  Here is an image of part of the AF_mshield_v12.sch
Pasted Image 3 25 15 10 08 AM

A 12V Wall Wart will be plugged into the Arduino’s barrel jack.  The 12V Wall Wart will power both Arduino’s 5V power supply as well as power the pumps.  While there are three pumps, the pumps will not be used at the same time.  For this reason the pumps will share a power source.   A nice aspect of Adafruit’s design is the lining up of GND such that both the 12V and Arduino’s 5V voltage sources are relative to the same GND.  My earlier attempts mistakenly did not align Arduino’s GND with the pump’s power source GND.  Well, it did help me understand what is meant by aligning the GND….  

From the FAQ section of Adafruit’s motor shield documentation:

My Arduino freaks out when the motors are running! Is the shield broken?

Motors take a lot of power, and can cause ‘brownouts’ that reset the Arduino. For that reason theshield is designed for seperate (split) supplies – one for the electronics and one for the motor.Doing this will prevent brownouts. Please read the user manual for information about appropriatepower supplies.

Adafruit’s design accommodates this by using a jumper and including a 2-terminal block for the V+/V- of a power supply.  When the jumper is not on the shield, the pumps use an external power source.  The “standard” power source – USB or a power source plugged into the barrel jack – is used for circuits on the shield that use the Arduino’s 5V power source.  The GNDs of the two power sources is aligned.

I’ll also make a small modification to add a green LED on the line to detect if the shield is getting power.  


I decided to not use temperature to adjust the probes.  Even though measuring pH is all about figuring out the amount of H+ ions clinging to the probe’s glass membrane.  When the temperature of the nutrient bath varies from the ideal of 25˚C, the amount of H+ ions changes.  I experimented adjusting the temperature and decided not remove the thermistor circuit for measuring temperature.  I made this decision:

  • I’m growing plants in my house. The water temperature will not vary much.  Perhaps the lighting will warm up the nutrient bath.  However, I am using LEDs.  LEDs do not dissipate much heat.
  • The measurements need to be precise, but inaccurate and span a range of values.  
  • While there will be a .1 inaccuracy, the leafy plants I wish to grow with the help of the Ladybug shield are cool-season vegetables.  As noted in this article, a healthy temperature range for a nutrient bath supporting cool-season vegetables is between 10˚C/50˚F and 21˚C/70˚F.  I will use 10˚C for my rough calculations since it is farthest away from the ideal 25˚C.  When the nutrient’s bath is at 25˚C, the amount of voltage between pH values is 59.16mV.  When the nutrient bath’s temperature is at 10˚C, the voltage between pH values is 59.16+(10-25)*.198 = 56.19mV, close to 3mV.  Since the resolution of the ADC set to 1mV LSB works well, an Arduino Sketch will be able to pick up this difference.  I would address this difference if I required both precision and accuracy.

for the environments in which I will be using the Ladybug Shield, the temperature will not vary enough from 25˚C to include temperature adjustment.  While the readings would be more precise, the range that is allowed for healthy growth is large enough that introducing the additional will not affect growing healthy plants.

Test Points

I am finding it difficult to look at two signals on a scope if the contact for the probes is one of the chip’s pins.  Now that I have a better idea on what to test, I am putting test points at the places I have found myself constantly measuring – the EC and pH inputs into the ADC, each phase of the EC signal processing.


Just a short update so that we’re on the same page on what the Ladybug shield is shaping up to be.  If this version passes tests, I should be close to completing the hardware!



Thanks for reading this far.  Please find many things to smile about.


Getting pH readings on my iPhone from the Ladybug Shield


, , , ,

As I get older, I evolve choices to which make me happier.  Perhaps selfish but life is so incredibly short…why not surround each other and ourselves with happiness?  Using my iPhone to interact with the Ladybug Shield makes me far happier than using an LCD.  Besides, programming in Swift is..well…fun….at least fun relative to other programming languages I have bumbled about.

I want to start using the Ladybug Shield around my house.  This “forces” me to get my nose out of the scope and into the UI.

The Goal

The goal of this post is to go through the process of building a minimal iPhone app that display pH and EC readings from a Ladybug Shield.

Open Source

The Arduino and XCode files are located at this GitHub location.

Adding BLE

The Ladybug Shield does not include BLE.  After many starts and stops, I ended up adding the RedBearLab BLE Shield.  

IMG 3383



I spent too much time trying to get the Bean to work (which I had used in a previous prototype).  Ultimately, the Bean could work, but the challenges that got me to decide on using the RedBearLab BLE Shield over the Bean for this prototype included:

      • getting a stable/solid wire connection between the Bean and Arduino over the I2C pins.  At one point I soldered header pins onto the Bean’s holes which screwed up the board….I ordered another….yah, D’OH mistake :-).
      • The Ladybug Shield uses the ADS1015 – another I2C device.  I use Adafruit’s ADS1015 library which assumes the ADS1015 is the master.  This means both the Arduino and the Bean must act as slaves.  This was ok, but complicated my coding.
      • The Bean is a 3.3V device. The Ladybug Shield and Arduino are running at 5V.  I was running into communication over I2C freezing when the ADS1015 and Bean were both involved.  Yes, I could add a level shifter as I have done in the past…but it is one more thing to deal with. 
      • The Bean needs an external power supply.  The easiest is to use a C-Cell battery.  My bad was to keep leaving the Bean on with the battery in.  I’d come back in the morning to yet another dead battery.
      • The Bean must use the older (1.0.5) version of the Arduino SDK.  In general these type of 3rd party dependencies become necessary evils.  While the Bean’s abstractions make getting a BLE app between the Arduino and an iPhone easier, the cost of not being able to update the SDK is high for folks that have at least an intermediate level of BLE programming.
      • The RedBearLab shield uses the nrf8001 BLE chip (data sheet).  I gave up a more friendly library of APIs, being “forced” to gain familiarity with a library for the nrf8001.  My BLE requirements are very minimal so it didn’t take me much time to get the Arduino sketch pumping out pH and EC readings over BLE.

The ReadBearLab shield uses SPI.  Instead of using a CS pin, it has two pins – REQN and RYDN.  As noted in the nrf8001 data sheet:

However, nRF8001 does not behave as a pure SPI slave device; nRF8001 can receive new data over-the air at any time or be busy processing a connection event or new data. Consequently, the traditional CSN signal used to initiate an SPI transaction is replaced by two active low hand-shake signals; RDYN andREQN  

Nordic Semi’s library (for Arduino)  defaults REQN and RYDN to pins 8 and 9. These can be set to any of the pins 2 to 10.  For this prototype the Ladybug Shield will work with the default pins.

Sending pH and EC Over BLE

I did not need real time readings so I decided it was good enough to package the pH and EC value in the RedBearLab’s advertisement packet.  I should be packing the readings into the data portion of the advertisement packet.



This shouldn’t be too hard once some amount of familiarity with Nordic’s interface – Application Controller Interface (ACI) is accomplished. if I follow the steps outlined in this support post:

  • Once the nRF8001 sends the ACI Device Started Standby event, you can use the ACI OpenAdvPipe command (lib_aci_open_adv_pipes) on the broadcast pipe.  When you are opening a pipe using the ACI Command OpenAdvPipe, you need to wait for the Command Response Event [that says the pipe is open…not just that the request was queued]
  • update the data in the Pipe by using the ACI Set Local Data command ( lib_aci_set_local_data)
  • Then start advertising using the ACI broadcast command.
These steps point out what is going on within a figure in the nrf8001 data sheet that discussing setting broadcast data:

Since this effort is “quick and dirty” I decided to set the RedBearLab’s peripheral name to the pH and EC values.  The details are covered in the Arduino sketch LadybugShield_BLESlave_V1.ino:

void loop()
{//don't do anything until BLE is ready
  if (ble_isAdvertising())
    float pH_value = takepHReading();
    DEBUG_PRINTF("--> pH: ");
    uint16_t EC_value = takeECReading();
    DEBUG_PRINTF("--> EC: ");
    DEBUG_PRINTLNF("Wait before taking another reading...");
    delay(10000); //take a break

I did modify the nrf8001 library to:

  • include ble_isAdvertising() to let the Arduino sketch known that the “ACI advertisement has begun event” has occurred.  
  • set the peripheral name:

        lib_aci_set_local_data(&aci_state, PIPE_GAP_DEVICE_NAME_SET , (uint8_t *)&device_name , strlen(device_name));

 iPhone App

 The (very ugly) iPhone app picks up the advertisement packets and displays the pH and EC value.  

IMG 0044

Ugly iPhone app Running on my iPad


I used an updated BTDiscovery class library I had used in a previous prototype to receive the advertisement packets.  The swift file is BTDiscovery02072015.swift.   The BTDiscovery class includes delegates that are implemented by the View Controller (ViewController.swift) to update the pH and EC labels on the UI.  Easy Peasy.  Did I mention how much I like the Swift language?





Thanks for reading this far.  Please find many things to smile about.

Making a Prototype Board with an Other Machine

 Last Thursday was a very exciting day.  My Other Machine arrived…Oh Happy Day!!!


This is the story of how I got from here:

IMG 3373

After the dust settled:

IMG 3374

To there:

1503130146 2


I can roll my own prototype PCBs.  Ah the YIPPEE!!! moments are piling up.  FANTASTIC.

The Goal

The goal is to master making prototype PCBs on my Other Machine.  By doing so, I have added a valuable tool that will stream my design to finished product work flow.

Thanks to Those That Went Before

A HUGE thank you to Simone, the wonderful person at the other end of my endless stream of support ticket entries.  Simone is knowledgable and evolves the role of support from something that sounds like a necessary prop to what it really is – the role that makes or breaks the success of a business.  We’ll see if Other Machine Co. gets my vote as a company I fanatically hope for success for the value and happiness provided – as I do with OSH Park.  With Simone they are on the right track.  When I got frustrated Simone pulled me out with patience and spot on advice.  I also thank the creators of the Other Machine.  You have brought us a significant leap forward in our ability to prototype hardware/software efforts.

Open Source

Kicad schematic and layout files are located at this GitHub location.

My Scenario

I found out through the Ladybug Shield project that there are smaller sub-circuits that could be immediately proved out and tested.  Yes, this means there is a new schematic and layout in Kicad that needs to be done.  But on the other hand, the schematic side is simple.  Doing the layout on simplified sub-circuits is good practice in getting better laying out PCBs.

Oh yeah – I can also make PCB stencils.  There is an instructable that outlines the steps.  As the Ladybug Shield stabilizes the stencil and the reflow oven will be used more.  I tried stenciling earlier (see this post) to see what it was like.  It is definitely worthwhile if reflowing many boards.  What I just don’t understand is why the copper pads and/or the parts don’t come with sticky solder so that once they are placed they can be popped into the oven and toasted.  I mean, we have double sided tape… I assume there is a chemical reason why this is a non-starter…chemistry is fascinating but not something I have knowledge in.

There are so many reasons why I will use both the Other Mill and OSH Park.  I’ll cover this in another post.  The main reason is the quality and sophistication of the PCB layout (vias, small track widths, finishing) are far superior.

Ladybug Pump

For this effort I am creating a PCB that will talk to the Arduino running the Ladybug shield and turn on/off a pump.  In the current Ladybug Shield design, the pumps hang off one side of the Shield.  After trying out the shield, I found having both the BNC connectors for the probes and the pump cabling to be very crowded, particularly in the nutrient bath where the pumps and probes would be co-mingling.  I decided to split the pumps off the shield.  Each pump will include a small board with the circuit I use here.  The pump will have a wire running from the Ladybug shield so the Arduino controlling the shield can send pump on/off commands.  Here is an image of the schematic (kicad files available at this GitHub location):



It’s Right There on The Board

It’s simple – don’t you get it?  It’s right there on the board…

Simple Math With Cat

That “simple” statement was a defining moment in my academic career.  It happened when I went up to my professor and told him I did not understand the triple integral expression he had carefully crafted on the board.  I give him credit for being enthralled and captivated in his work.  However, I did not appreciate the annoyed look and condescending comment.

Why mention this?  Because I love learning stuff I am clueless in – particularly in the design and building of hardware and software –  and developing some level of mastery.  I arrive at this particular learning opportunity with no knowledge of its language, culture, or context.  I visit.  I learn a new language and a new skill.  I had never used a CNC machine.  I vaguely remember way (way) back in high school that when I took Home Economics and boys took metal working, there were milling machines…hmmm…but my vision was clearly focused on sugar plum cookies.

Anyways, when I first started using the Other Machine among the many oops! moments I managed to break two of the end mills:

broken End Mill

I bumbled through over 11 tries and submitted (too many to count) support tickets before I felt I had enough knowledge to feel confident I could actually create a PCB that I could populate with SMTs.

The Goal

The goal of this post is to add the Other Machine into my workflow by improving my ability to build prototype PCBs.  At the end of this post I will have gone through many trials.  Along the way, I will build and test a PCB.

The Workflow from KiCad to Other Machine Milled PCB

Loading the Gerbers and Drill File

As the web site notes in this post, Other Machine’s Otherplan software

  • can load Gerber and drill files
  • run well on my MacBook

and…wait for it…it worked!…well, good enough.  I had one challenge but it was not a showstopper.

When making plots in Kicad’s PCBNew app, I chose to plot the top copper, bottom copper, and edge cut as well as generate the drill file.


 While I could use the Other Machine to make double sided PCBs, the Ladybug Pump PCB has the circuit on the top side copper only.  So the bottom copper is not needed.  I included it because well, what the heck.  the Other Machine’s software (OtherPlan) reads it and I will probably do double sided PCBs in the future (those darn vias…).  It’s good practice to get in the habit of including the bottom copper early on.  

Kicad creates the files with the following names:


where .gbl = bottom copper, .gtl = top copper, .drl = drill file, .gbr = edge cut

Otherplan wants the file names to all be the same.  So I renamed them:


I was not able to get Otherplan to recognize the board outline (edge cut) file.  I tried renaming the .gbr to both .gko or .gm16..but the post on using Gerbers also noted:

.gtl is the top copper layer. This contains the Top, Pads, and Vias layers. It also tells Otherplan to look for the following associated files:

  • .gbl bottom copper layer. Contains the Bottom, Pads, and Vias layers.
  • .gko or .gm1-.gm16 board outline. Contains the Dimension layer.
  • .txt or .drl drills/holes. Contains the Drills and Holes layers.

I opened up LadyBugPump.gtl in a text editor but did not find any association with an outline layer…maybe that is the problem.  I do not know for sure. I forged ahead because Otherplan kindly created an outline and all the other files read in correctly.  Let me pause for a YIPPEE! moment.

Matching the Layout to the End Mills

When learning a new tool and process, my quest revolves around getting into the heads of the folks that built the tool – both hardware and software.  All of us come at a work flow from a different background with different ways of approaching getting through a process.  Given that I have never used a CNC machine before, it was logical to me the folks that built the Other Machine’s idea of an intuitive work flow in the creation of a PCB would not be initially intuitive to me.  Thanks to Simone, I now at least feel I am on the expected path.

What I needed to “get” was to think about spacing between what would become the exposed copper – the pads and tracks.  The spacing between the exposed copper parts becomes part of the layout as well as the choice of end mill(s).  When I send Gerbers to OSH Park, their constraints

  • 6 mil minimum trace width
  • 6 mil minimum spacing
  • at least 15 mil clearances from traces to the edge of the board
  • 13 mil minimum drill size
  • 7 mil minimum annular ring


OSH Park’s minimum drill size and minimum annular ring


allow me to be very flexible and more complex in my layout.  

End Mills

I am next to clueless when it comes to picking the right end mills.  For this effort, I relied on Other Machine’s guidance:

Requires a 1/32″ or smaller end mill

  • SOT23-3 (Small-Outline Transistor)
  • SOT23-4 (Small-Outline Transistor)

Requires a 1/64″ or smaller end mill

  • 8-SOIC (Small Outline Integrated Circuit)
  • 14-SOIC (Small Outline Integrated Circuit)
  • SO-8 (Small Outline)
  • SOT23-5L (Small-Outline Transistor)
  • SOT-223-4 (Small-Outline Transistor)

Requires a 1/100″ or smaller end mill

  • SOT23-5 (Small-Outline Transistor)
  • SOT23-6 (Small-Outline Transistor)
  • TSSOP (Thin-Shrink Small Outline Package)
  • TQFP (Thin Quad Flat Package)

Not compatible

  • WLCSP (Wafer Level Chip Scale Package)
  • QFN (Quad-Flat No-Leads)
  • DFN (Dual-Flat No-Leads)
  • MSOP (Mini Small Outline Package)
  • LQFP (Low-profile Quad Flat Package)

Luckily, the “Not compatible” is above my soldering ability!

This is obvious but new to me – end mills come in all sorts of sizes and shapes.  These sites helped me get up to speed:

I had ordered the electronics bit bundle which included 2 1/32” and 2 1/64” end mills.  A challenge I had was figuring out which bit was which size.  Obviously, putting the tip under the magnifying glass would reveal the difference.  The other way (that Simone recommended) was to use a caliper.  I would have prefer the end mills to have a distinctive mark…oh, it could be something fun – similar to a pencil caps: 


that cover the cutting side of the end mills.   Besides identifying a 1/64” from a 1/32”, the caps would protect the end from breaking off. A sad moment for us, but a ca-ca-ca-chink moment for companies that sell end mills.  OK, it could be as simple as the itzy-bitzy writing on SMT resistors (although frankly, that reeks of seriousness).

Given that I will most likely be breaking more of the end mills and those that don’t will wear out, I am a bit concerned about the price of end mills.  Ah – the razor and blade business model!  Is the razor/blade model a requirement for things that shave off?

Razor And Blade

Drill bits are such a commodity that I can go to a hardware store and have a choice of high quality at a reasonable price.  End mills for us home PCB makers using a CNC machine don’t share this advantage.  Well, maybe they do but I don’t know about it.  I assume the end mills used for PCBs are used for other CNC carving efforts…

I also do not have a grasp on the features and quality of the end mill.  For example, Other Machine’s end mills range in price from $13 to $21 (link to store page).  Adafruit sells end mills for $4 (link to one of the offerings).  Why the difference?  As it was explained to me by a folk at Other Machine:

End mills go for anything from $3 to over $40+ a bit, and they are not all created equal. The ones that Adafruit carries have longer shanks, meaning they’re not meant to travel sideways. They are brittle and specifically for drilling holes. The ones we carry will last up to 2000 inches on pcb before they start to get dull. Also, we special order the 1/64th’s and 1/100th’s with shorter shanks so they will be less likely to break.

Given that the likelihood of me breaking end mills as I learn is higher, I’d probably benefit from getting Adafruit’s.  For now I will stick with Other Machine’s.  My buying habits will expand to other offerings as my skill and knowledge improve.  Perhaps asking folks what end mills they use is a good conversation question at a maker event.

Layout and Size Matter

The PCB’s layout partners with the end mill’s size to determine if there is enough spacing between the pads and tracks so that the copper areas that should not be connected are separated.

 Here is a layout I had done where the track and pads are too close together (given the end mills I had):


Pasted Image 3 13 15 8 12 AM

 Track and Pad Too Close Together With 1/64” End Mill


Here is the layout I ended up with:

Other Machine Final Layout

If I left the Otherplan software to cut this out, I end up with:


IMG 3375

I wanted to cut out the copper in the areas that do not have exposed copper so to get to this:

1503130146 2

Simone once again to the rescue.  She advised me:

  • go to Otherplan > Preferences, and click on the BitBreaker Mode box.  (yes – bit breaker – sounds like my moniker!)  Once you’ve done that, in the imported plan file window for your Gerber you will see a button called “Advanced Options”.
  • Click on “Advanced Options”, and you’ll see a line item for Trace Clearance. To make sure all your copper gets cleared, just set Trace Clearance for something huge, like 2 inches. This will get rid of pretty much all the excess copper on your board.

Keep in mind though, that depending on the tool you are using, this could take a while to cut! For example, if you have a 1/16” flat end mill selected, this will clear the big areas faster that the 1/32”. 

 That did the trick!

What’s Next

I am thrilled to add the Other Machine to my tool set.  I must say this electronics learning hobby gets expensive.  But on the other hand, it could be much worse.  I could be paying what I am for my kid’s educations :-).  

I now have multiple techniques to use to prototype circuits from break out boards on bread boards, SMT parts soldered to a SMT-to-DIP board and placed on a bread board, to the Other Mill..and finally, Osh Park.  I can see a use for each one in a continuum of prototyping needs.  

I guess that is what next, an ongoing prototyping effort that leads to useful “stuff” like the Ladybug Shield.



THANK YOU for reading this far.  Please find many things to smile about.

Ladybug Shield Alpha V2 – Comparison with Atlas Scientific EZO EC Stamp


, ,

And now for the exciting part….comparing EC readings between the Ladybug Shield and Atlas-Scientific’s EZO EC Stamp.  Yes, I designed the Ladybug Shield for a different use case than the EZO EC Stamp.  But I thinking of the EZO EC Stamp as a “gold standard” of Arduino EC sensors.  Also, I use an Atlas-Scientific probe so both measurements will be using the same probe.

The Goal

The goal of this post is to compare EC readings when the Atlas-Scientific EC probe (K=1) is submerged in:

  • 2000µS
  • 1413µS
calibration solutions.

Thanks to Those That Went Before

A huge thank you to Chris Gammell for mentoring and teaching his excellent Contextual Electronics courses.  A year ago I would not have dreamed I would be able to build the Ladybug Shield.  I give Chris the credit for getting the EC circuit to work in key areas – like advising to measure Vin as well as Vout.

Another giant thank you to Ryan @SparkysWidgets.  Ryan open sourced the design of the minipH and miniEC.  I absorbed and evolved these designs into the Ladybug Shield.  Ryan has been extremely helpful in my efforts.

Use a K=1 EC Prob

The protagonist of any EC measurements is the probe.

Conductivity probes that I am aware of have these dimensions:


Probes may vary in the distance between the electrodes.   EC = (the distance between electrodes/area of an electrode plate) * conductance.  The distance between electrodes/area of the electrode plate is known more commonly as the K constant, or just K. A probe with K=1 has 1cm distance between electrodes with 1 cm squared area of electrode plate.  I started with a probe with a K=.1. I figured a shorter distance between the plates would amplify the incoming signal and therefore get better readings.  I found however the design of the Ladybug Shield’s EC circuit was better suited for a K=1 probe.

Here is an image of the EC Vout when K=.1:


The gain loop is amplified to the point where the peaks are chopped.

Here is an image when K=1:



 My probe has a K of .1/cm -> .1cm distance between electrodes/1 cm squared area = .1/cm.  Since the electrodes are closer together, the probe can be used in lower conductivity solutions than a probe where the K=1.  Until I know better, a probe with either K=1 or K = .1 should work.

Tables for EC values of vegetables have a nasty habit of leaving off the distance, assuming the probe has a K of 1.  For example, a page that lists EC values for vegetables notes: Electro-Conductivity (EC) or Conductivity Factor (cF) can be expressed as… milliSiemens (mS).  This is true if K = 1.  When K = .1, EC = K *conductance. The table lists the EC value for lettuce to range from .8 to 1.2mS.  When K = .1, EC = .1*.8 to .1*1.2 = .08 to .12mS


The Ladybug Shield and the A-S EZO EC Stamp used the same K=1 EC probe.



The table below shows the µS value for the EZO and Ladybug Shield when the EC probe is in a 2000µS and then 1413µS calibrated solution:

Calibrated Solution Ladybug % difference EZO % difference
2000 2059 2.91 1875 8.42
1413 1388 1.79 1254 15.68

The results seem too good to be true.  The Ladybug results were very close to the calibrated solution value.  Talk about a YIPPEE! moment….

The biggest change in the Ladybug shield to get better results was the reading of Vin (the shrunken signal generated through the Wien Bridge Oscillator).  As I noted earlier, Since both the Vin and Vout are key variables in calculating the Gain – it makes sense to measure both.

Ladybug Calculations

In the case of the 2000 µS calibrated solution, Vin = 239mV  Vout = 731mV.   Gain = 731/239 = 3.058577406. R = 1000/(3.058577406-1) = 485.77235769 Ω EC = 1/485.77235769 = .002058577 S = 2059µS.

In the 1413µS solution, Vin = 237mV Vout = 731mV  Gain = 566/237 = 2.388185654 = R = 1000/(1.388185654-1) = 720.364741646Ω EC =  1/720.364741646 = .001388186 S = 1388µS.

That’s It For Now

The EC circuit appears to be working.  A Definite YIPPEE! moment.  



Thanks for reading this far.  Please find many things to smile about.

Ladybug Shield – A Better Understanding of The Interaction Between the MUX and FET


I recently modified the EC circuit to read both Vin and Vout of the EC gain loop.  This way the Ladybug Shield would provide the closest readings for the Gain (Vout/Vin).  Once the gain is known, the resistance of the EC probe in the nutrient bath can be measured.  Once the probe’s resistance is known it is a small skip to calculate the Conductivity of the nutrient bath.

Thanks To Those That Went Before

  • Chris Gammell advised me on how to think about and debug this challenge.  Chris is an excellent teacher/mentor.  I have learned A LOT from his Contextual Electronics courses and his mentorship.  THANK YOU.
  • Ryan (SparkysWidgets) open sourced the minipH and miniEC.  This effort has allowed me to gain a jump start in my understanding of the electronics behind pH and EC circuits.  Besides that, Ryan is an exceptionally smart, kind person who readily shares his knowledge and has provided me with excellent advice.  THANK YOU.
  • Laen and the people/company at OshPark.  I have become an advocate of OshPark.  They are a model of the most excellent service/support providing quality product at a reasonable price and turn around time.  THANK YOU.

Open Source

The kicad schematic and layout are located at this GitHub location.  The schematic to view for this post is the Rectifier schematic.

I recently started measuring both Vin and Vout of the EC gain loop.  


The Challenge

For weeks I have been poking at really understanding why I am seeing readings from the ADC start high and eventually drift down to the right value when these events occurred:

  • switch MUX to take Vout readings
  • turn FET on for around 4 ms to drain the capacitor
  • switch MUX to take Vin readings

Challenge 1: Start high, Go low

Vin readings start out high (say around 900mV) and eventually (after hundreds – say 2000 readings) stabilize at an expected value (say around 250mV).

I stumbled around mumbling what I thought was going on.  The problem was I didn’t have “the smoking gun.”  I didn’t have proof of what was going on until….until…I gained a better understanding of how to use a scope!

Chris advised me what to look for:

On channel 1, monitor the gate voltage of the FET.On channel 2, monitor the input to the buffer (the output from the rectifier circuit).
If you trigger on channel 1 going high, you can see the behavior the FET is causing (hopefully draining the cap). 

(RIGHT THERE – the cost of Contextual Electronics paid off !)

Ah yes…just like any great detective knows…figuring stuff out is about figuring out what to look for and then finding it.

After figuring out the difference between “Auto” “Normal” and “Single” triggering I realized what I wanted was to set my scope on Normal triggering.  Personally, I found (find?) how triggering works confusing at first.  But well worth learning :-).

And look at that:

FET Trigger HIGH

The blue line follows the FET as it transitions from OFF (low) to ON (high).  When the FET is on, the cap is discharging.  The yellow line starts reading the rectified Vout and then switches to Vin at about the time the FET is set to HIGH.  It turns out the cap discharges in about 25µS.  With the FET on HIGH, the cap is kept discharged.  

I then set a trigger to happen when the FET went to LOW using an Arduino sketch that executed one after each other:



The scope showed the capacitor was fully discharged within the time it took the Arduino sketch to execute the digitalWrites():


Given the small amount of time it takes to discharge the cap, a digitalWrite(FET,HIGH) immediately followed by a digitalWrite(FET,LOW) gives more than enough time to discharge the cap (about 80µS for the code to execute while it takes about 25µS for the cap to discharge).

Challenge 2: Settling Down

Another challenge I was facing with ADC readings was slightly higher readings right after turning the FET OFF.  So I took another scope measurement.  This time I ran an Arduino Sketch that:

byte S = HIGH;
Serial.println(“send VOUT for 1 seconds”);
S = LOW;
Serial.println(“Switch to VIN”);
//turn FET on and off to discharge the capacitor
Serial.println(“FET ON”);
Serial.println(“FET OFF”);
Serial.println(“send VIN for 6 seconds”);



The focus is on the reading for Vin between the two readings for Vout.  When the MUX switches to VIN, it takes about 3 seconds for VIN to stabilize.  I’ll add a delay(300); after switching to Vin and discharging the cap.


That’s It

What this post is about for me is a better understanding of how to use a scope to get a better peek into what is going on within the innards of the analog part of the circuit.  WHOA!  I am excited to have learned this…hopefully I will start applying my new found debugging/viewing skills and shorten my bumblings when it comes to  debugging what is a mysterious world for me – the analog circuit…


Thanks for reading this far.  Please find many things to smile about.


Ladybug Shield Alpha V2 – Testing the pH



Spoiler alert…wait for it…the pH circuit works!  Talk about exciting.  I truly enjoy learning all the skills and different disciplines that goes into building a working pH sensor…math, science, electronics, designing, laying out, and building a PCB, writing the software,..and most importantly – the people I learn from along the way.

Ladybug Shield V2

Here it is – a thing of beauty – a fully populated Ladybug Shield Alpha V2 hooked into an Arduino:

IMG 3326


I got to use my Zallus controlled reflow oven.  I really like the Zallus (toaster) oven controller.  Heck, I really like the idea of popping a PCB in a toaster oven after carefully placing soldering past and SMT parts.  It is so Easy Bake Oven…I can’t help but smile.

The Goal

The goal of this post is to compare the results of pH circuit tests of the Ladybug Shield with those from an Atlas-Scientific EZO pH stamp.

Thanks to Those That Went Before

Thanks to Chris Gammell and his Contextual Electronics courses I was able to get to this point where I have pretty much finished the firmware and hardware design for the pH portion of the Ladybug shield.

Thanks to Ryan @SparkysWidgets for embracing/helping us followers of his minipH open source product and project.  I find it amazing to learn so much from all that he has shared.  My hope is this effort is a positive contribution to the minipH effort.

Open Source

I will be discussing the contents of the Arduino sketches available at this GitHub location.


pH probes lose their vitality over time and eventually need to be replaced.  In the mean time, the slope of the line mapping pH mV to pH value needs to be calibrated.


I use 2 points to determine the slope of the pH mV/pH value line.  The two points come from reading the pH when the probe is in pH 4 and pH 7 calibrated solutions.  The step between pH values for an ideal probe is 59.16mV.

The calibration sketch I used is located at this GitHub location.

When the probe was in pH 4 calibration solution, the reading was 155mV averaged over 11,551 samples with a standard deviation of .49.  When the probe was in pH 7, the reading was -29mV averaged over 3,859 samples with a standard deviation of .40.  

I felt the variability between readings to be smaller than expected.  I don’t have a sound reasoning other than I expected more noise between samples. Maybe < 1standard deviation is what is expected.  The results were expected.

The pH slope = y/x = (155 – -29)/(7-4) = 61.33.

Now when pH values are calculated, a step value of 61.33mV will be used instead of 59.16mV.

Read pH

See the calcpH() function in the Arduino sketch.

(note: I evolved this part from Ryan – SparkysWidgets – minipH.ino.  Thanks Ryan!).   Converting the mV value from the ADC into a pH value involves two steps:

  • compensate for the offset of the pH 7 mV reading of the probe from the ideal of 0 mV
  • figure out how many steps away the mV reading is from pH 7.
Since figuring out how many steps away the mV value is from pH 7 assumes the ideal pH 7 = 0mV, start with adjusting the mV value to compensate for the pH 7 mV value.  From calibration, the mV value for pH 7 for the probe I used was -29mV.
When I put the probe into pH 4 calibration solution – this time to read the pH and not calibrate – the mV reading from the ADC was 153mV.  Given the offset, the mV value when pH 7 mV = 0 is 153 – -29 = 153 + 29 = 182.  Calibration provided the probe’s step value at 61.33mV.  The pH value of a 153mV reading given this probe = 7 – 182/61.33 = 4.03.  Wow!  That’s a darn good measurement.

Compare with Atlas-Scientific EZO pH Stamp

 I had an older Atlas-Scientific pH Stamp so I purchased the EZO pH Stamp.  I have to say I am very impressed with it.  With the older pH stamp I had to send a command several times to make sure it pH Stamp reacted.  This was not a challenge with the EZO ph Stamp.  Unpacking the EZO and first use is a pleasurable experience that requires no additional electronic knowledge.  In short, if you want a “high” quality pH sensor that works with an Arduino, the EZO is worth a look.

I compared the readings from the EZO pH Stamp with the Ladybug Shield for two solutions:

  • White distilled vinegar
  • Baking soda added to filtered water
  EZO Ladybug % difference
Vinegar 2.56 2.67 4.21
Baking Soda 7.94 7.85 1.14
The difference in readings is acceptable.

What’s Next

Work on the pH measurement circuit and firmware is almost done.  I have learned a lot as I traveled this journey.  From the science and math behind a pH measurement to the electronics used to detect a voltage that can then be interpreted in a pH value.  I got a lot of help from folks like Chris Gammell and Ryan @SparkysWidgets.

I haven’t added temperature adjustment.  I’ll do this in an upcoming post.


Thanks for reading this far.  Please find many things to smile about.



Get every new post delivered to your Inbox.