My Light Fixture for Growing Tomatoes

Tommy (the tomato plant) is growing quite nicely.

IMG 3475

Tommy in our Kitchen

IMG 3477

Yippee!  Starting to Flower

I’ve decided the LED light I am using from – the Lumia 5.1 – will work for tomatoes.  


This light has 5 channels, each needing a constant current of 700mA.  It also gets really hot, so it needed a heat sink.  I ended up mounting the light on a CPU heat sink


The CPU fan/heat sink works extremely well at a price around $25.

I used 5 MeanWell LDD-700H constant current drivers (data sheet)


hooking each channel of the LED to one of the LDD-700H drivers that I mounted onto a breadboard.  Wiring it all up and putting a reflector around it got me this FrankenLED:


Bwa-ha-ha …but it works…

The LED is plugged into a power supply I got from LEDGroupBuypower supply

so that’s Tommy.  On my next post I will be building a PCB for a light fixture to hold three of the Lumia 5.1s to expand the number of tomato plants I will grow in my kitchen.


Introducing the Ladybug Plant Food Adjuster


, , ,

I’ve put the Ladybug Shield together with other hardware and software to implement a kitchen farmer plant food adjuster.  For now I am calling this the “Ladybug Plant Food Adjuster.”  I am currently testing/using it in my home.

The home farmer will be growing lettuce, herbs, tomatoes… within their home,  likely the kitchen.  This is in contrast to the more expert hobby or professional that has “industrial capable” pH, EC – and other probes, honking LEDs,…i.e.: knows A LOT about growing vegetables and herbs and needs super fine control of plant food adjustment.

Thanks to Those That Went Before

It is difficult for me to imagine being able to build the Ladybug Shield (see previous posts) without Chris Gammell and Ryan (@SparkysWidgets).

  • Chris Gammell runs the exceptional Contextual Electronics courses.  While I pay for the privelege, it is indeed a priviledge to feel and be treated like an apprentice.  Besides shear learning in a supportive and peer environment, Chris’s 1:1 time has been valuable/insightful/amazing in shaping the design of the electronics of the Ladybug Shield.
  • Ryan open sourced his minipH and miniEC stamps.  I poured over Ryan’s design until I understood them.  I had no idea how a pH or EC meter worked.  Ryan’s work significantly simplified what I needed to learn and my approach.  ON TOP OF THAT, Ryan is a truly great and very helpful person.  Please support Ryan!
While there are many great companies, two have made a HUGE POSITIVE impact on this project:
  • OSH Park the most excellent producers of low volume (purple!) PCBs.  OSH Park has the most amazing support and personal service.  From the CEO (Laen) to the support person who took his efforts in helping me out to the next level (Dan) – if I must part with my money, there is no better company/service/group of folks.
  • Adafruit, providers of breadboards, all sorts of circuit creation “thingies” that are too cool not to buy, exceptional tutorials, libraries for chips (like the ADS1015 ADC I used on the Ladybug Shield) that work within the Arduino IDE, and terrific support on their forums.  EVERY post I have made has got a valuable response.  What a great company.  
Then there are podcasts, videos, and a slew of web pages that have willingly shared their knowledge.  A particular shout out goes to Elicia White, co-host of the podcast.  She wrote a blog post on a question I asked that was very useful for me.  Now – there have been many more.  Elicia’s insightful answer is the most recent.

What The Ladybug Plant Food Adjuster Does

The Ladybug Plant Food Adjuster automatically adjusts the nutrient and pH level of a reservoir of water (the hydro part) feeding growing plants.  It is for people like me that enjoy fresh vegetables and herbs.  We have many reasons to supplement what we buy with what we grow in our kitchen.  While I garden both indoors and out, I live in an environment that does not support growing vegetables and herbs year round.  Besides, in the winter it is rainy and cold.  During the winter I don’t want to spend time in an outdoor garden but love being surrounded by healthy growing plants in my kitchen.

The Components

The Ladybug plant food adjuster consists of:

Ladybug plant food adjuster

  • The probe box:
    •  measures the pH and EC values in the reservoir of water being used to feed the plants.
    • communicates with the iPhone app (using BLE 4.0) updating the app with pH and EC measurements.  The iPhone app controls the probe box by setting what type and stage the plant is in (in the diagram above, the type of plant is tomato and the stage is Youth.  The type and stage set the values for the set points which will be used by the pumps to figure out if they are far enough away from the set point to add a dose of either pH adjustment or EC concentration).
    • communicates with the pumps (using wires) to turn on either the pH or nutrient pump if the readings are off too much from the set points.  It knows to add nutrients before pH adjustment since additional nutrients will change the pH level.  This is an example of “working smart for you.”
  • The pump box:
    • contains a pump to add nutrients and a pump to adjust the pH level.  It is controlled by the probe box (the “brains”)
  • The iPhone app (is currently really really ugly…but works on my iPhone and iPad.  The goal is to be functional for testing.  Design will follow function):
    • connects to the probe using BLE 4.0
    • gets info from the probe on what it is monitoring (plant type and stage) and whether the pumps are currently allowed to be pumping or should be off (regardless of the pH and nutrient level in the reservoir).  It uses this info to update the display
    • lets the grower set the name of the plant as well as the plant type and stage.
    • displays the most recent readings for pH and EC as well as the set points.  This way the grower can see if current measurements need to be adjusted
    • informs the probe whether to turn off or on pumping.  If pumping is turned off, the probe will not tell the pumps to turn on even if the measurements need adjustment.
    • lets the grower export then email the readings into a CSV file.

The Ladybug Plant Food Adjuster Hardware

Hardware includes an iPhone/iPad as well as the probe box and the pump box.

The Probe Box

Inside the probe box is an Arduino Uno with a Red Bear BLE shield and Ladybug shield attached to it.

IMG 3430

The schematics and layout (Kicad) are located at this GitHub repository.  Designing and implementing the shield was my way to learn electronics, making a PCB, the math / science / electronic design of pH and EC sensors.  It was – and continues to be – a very positive experience!   Please see the many earlier posts I have done detailing what I learned/what I ended up implementing and why.

IMG 3434

A pH and EC probe are attached to the Ladybug shield using the BNC connectors.

The back end has holes carved out for:

  • cable to 12V wall wart.  A 12V Wall wart powers both the pumps as well as the Arduino
  • the USB cable used by the Arduino.  This is optional.  I use it while debugging to print out to the serial monitor.
  • the wires that attach to each pump.

The Pump Box

The pump box contains two peristaltic pumps, one for adjusting the pH level and the other to adjust the nutrient level.  

IMG 3433

Wires – originating from the Probe Box connect the pumps to the Probe.  The Ladybug Shield uses the 12V wall wart to power the pumps.

How the Ladybug Plant Food Adjuster works

At the core of the Ladybug Plant Food Adjuster is the reservoir containing water with the nutrients set at the right pH level.  We start with a bucket.  It can be any bucket.  For now I’m using Rubbermaid.

IMG 3443


One of the Rubbermaid Buckets I Use

 But I have bought much nicer looking reservoir/hydro systems.

IMG 3442

Nicer Looking Bucket Growing Basil on Kitchen Counter


 My goal is to evolve into happy designs that please the grower.  Right now I am at the “Frankenstein” phase.   While single plant setups are “easy”, each would take its own Ladybug Plant Food Adjuster.  I will start using the Adjuster to grow about 6-12 heads of lettuce.  

I fill the bucket up with filtered water.  The less minerals/salts the better since the amount of nutrients is a measurement of the conductivity of the salts in the water (discussed perhaps more than you wish in previous posts).

I add an air stone to increase the amount of dissolved oxygen.  After all, plants need to breathe.  

Next, I attach a pH and EC probe to the Probe box and place the probes into the filtered water.

It’s time to mix up the pH and nutrient concentrations that the Pump Box will add to the filtered water until the EC and pH values are at healthy levels for the plant type and stage (of life).

Plant Food

I’ll use the term “plant food” when referring to the nutrient concentration.  Once the plant food is available for pumping, the Ladybug Plant Food iPhone app sets the recommended levels for the pH and EC.  The (yah – I know – extremely ugly…) setup screen of the iPhone app uses a UIPickerView to let the grower tell the Ladybug Plant Food Adjuster what type and stage the plant(s).

Ladybug app settings screen

The Settings Display of the iPhone app

  The image shows “Tomato/Youth” – this tells the Adjuster what the pH and EC levels should be.

As an example, here is my tomato/youth plant I am growing.  We call it/him/her? Tommy.

IMG 3440

Tommy Doesn’t Know What Day it is

What the “right” food is to feed a plant is based not only on scientific reasoning  but also what works best for you and how much you are willing to pay.  I started off using liquid fertilizers like the one I linked to from Amazon (if you click on the link and buy something I get an Associates fee – what the heck, that’s why this ad prominently placed below): 


As my knowledge evolved, I started using the product and advice from Hydro-Gardens.  The site has information on food and additional chemical compounds as well as the amount for several vegetables.  For example, here is the “recipe” for growing tomatoes.  I got the dry ingredients and then mix up the amounts for whatever it is I am growing.

IMG 3441

Dry Ingredients I Mix together to Feed a Young Tomato Plant

Now that I have the mix I need for growing a young tomato, I put many (I put around 5) scoops into the container and fill the container with filtered water.  The pump’s nutrient feeder hose is stuck into the plant food.

IMG 3444


The Plant Food Container 

I will stick the nutrient feeder hose into.  It is challenging for me to get all the particles mixed well. I’ve tried integrating mixing into an exercise routine.  At some point I need to think of “best ways” to mix the plant food.  I’d also like a better suited container.  I had just finished the contents of a salsa container so it became the plant food container – at least for now.


The Ladybug app knows to adjust the nutrient level before adjusting the pH.  The additional nutrients will change the pH of the water.  Once the nutrient level has been reached, the Probe goes through adjusting the pH level.  In all cases that I have come across, the pH of the water needs to be adjusted down.  This is why I use only one pH dosing container.  Which also happened to have held salsa…hmmm…too much salsa?  Nah…never…

IMG 3445

the pH concentrate is about a tablespoon of pH DOWN with water.  The concentration of Hydronium ions – which is what is being added to lower the pH level – is very intense.  This is why I dilute from pH down.

There’s an App for That

I decided to talk to the reservoir through an iPhone app.  I use the iPhone and have a developer’s license.  The app uses Apple’s Core Bluetooth framework to talk via BLE 4 to the Probe Box.  The probe box sends whomever it is connected to (in this case my iPhone running the Ladybug app) updated measurements as well as the ability to turn pumping on/off as well as select the plant type and stage.  I envision in most cases leaving the pump state on and letting the Probe Box determine if more dosing is needed.

Ladybug app home screen

 Settings were discussed earlier – see the settings screen shot.

I wanted to evaluate the data so I added the ability to export and then send what has currently been logged in a data base.  I then use a spreadsheet program to take a step back and see how well feedback and adjustments are going.

That’s it.  The app has two screens.  

What’s Next

It is hard to describe the sense of joy I have coming this far.  I’m setting up a reservoir for 6-12 lettuce.  I’m off to get that going and to plant lettuce seeds.



THANK YOU for reading this far.

Please find many things to smile about.

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.


Get every new post delivered to your Inbox.