Creating a soil moisture sensors using nails and Intel Galileo

Believe or not, I worked in a project with hardware and software created in 8 weeks only. I am talking about Intel Galileo ! The first intel board compatible with Arduino API plus some new and cool features.


Before to talk about how to create a very affordable moisture sensor system, let me explain what is Intel Galileo.

About the Intel Galileo Board – Hardware

Intel Galileo is a board with new processor called Quark SoC X1000, x86 based, 32 bits, single-core/single thread processor full compliance with ACPI and support RTC. Do you remember pentium ? Yes, chipset instruction compatible but smaller, affordable, ACPI enabled and very simple to use.

The board contains also contains:

  • ethernet connector
  • pci-e bus (mini PCI)
  • sdcard slot up to 32Gb
  • the regular arduino Uno pins for digital and analog IO’s and an IO expander able to generate 8 PWN channels
  • 1 USB port as host (2.0) and accepts up to 128 devices
  • 1 USB port for programming (2.0)
  • contains 512Mb flash and 216Mb RAM
  • reset button for the processor, reset button for the sketches
  • 10 pin jtag-connector
  • The board can operated in 5V or 3.5V (jumper configurable)
  • 11kb EEPROM available (yeah.. we have a API for this.. click here)

The schematics are available.

About the Intel Galileo Board – Software

Intel Galileo uses Linux as OS and you can boot from flash SD card.  The cool thing on this board you have the Arduino APIs available that means you have the IDE for Linux, Windows and Macs in 32 and 64 bits.

Only Arduino API experience ? NO!!!! We expanded the experience.. you have new components in the board so new APIs were created like RTC, EEPROM, Web client, etc. Another details is, the servo API is a new methods added that can allow your servos working with 188Hz (for more precision) or 50Hz.

Considering we are running linux, when you install the IDE all the crosscompilers are installed also (toolchain). It means you can develop using native C/C++ ANSI and using the linux libraries. Arduino IDE on this case will be optional to you because you can develop your code natively and transfer using ftp for instance.

When Intel Galileo will be releases and how much will cost ? And does it worth ?

The official date is Nov, 29/2013. The cost will be around US$ 50 to US$60 bucks! I do not have the details yet..

Intel Galileo has an ethernet connector and a pci-e bus. If you are developing anything with Arduino and requires internet connection you will be forced to buy an expensive wifi/ethernet shield that costs US$ 65 bucks! If you are using Galileo you can use the embedded ethernet connector or you can buy a simple Wifi and Bluetooth module pci-e compatible in amazon for only US$ 8.00.

The same if you need a video card!

Another plus is the RTC.. You do not need another shield with RTC.. The same with SD card, you do not need another shield for data logging because you can use the APIs and store your data up to 32Gb sd card using the slot already present.

These will save a lot of money and you give you a powerful board for your project.

How do I start ?

If you are Arduino developer you will realize the IDE is mostly the same excepted by the new APIS added and the option to update the board firmware.

You can take a look in the “Getting Start Guide” and download the IDE and you can choose Windows, Linux or Mac for IDE.

This IDE a feature very special that allow us to update the Linux OS in your board (flash or SD card). Take a look in the Start Guide for more information.

The Soil Moisture System using Nails

Now you already have an introduction about what is Intel Galileo Board. Let’s talk about this very simple project.

First of all, I created this project in 2 hours and I used this project as a demo in Maker Fair in Rome/Italy.


People, did not understand (at glance) what two coups with soil and wires were doing over the table in an electronic fair but when they realized they loved (including the intel CEO Brian Krzanich).


The system is based in two sensors. Each sensor is built using galvanized nails connected to an analog port and making a resistor division with another resistor. The sensors also keeps the nail separated in a distance equivalent of 1.5 inches using pieces of foam that I found in the trash. Yes! the system is simple, cheap and you can monitor your soil only using nails. I choose galvanized for obvious reasons.. I do not want to see the nails rusted in a short period of time.



This is more than enough to check if soil has water in good amount to the plants or not. Considering was a fair, I build a LED matrix in order to show a happy or sad face. This face has a push button as well.

If “one eye” is on, means sensor number ONE. Two “eyes” means sensor number TWO. The sensor selection was done using the push button. On this way, you could see “one” or “two” eyes being switched by the users. In the fair, I had two coups each of them with soil but one of them with a little bit of water and each coup connected to a sensor.



Then, each sensor is connected to a respective analog port (A0 – sensor 1 and A1 – sensor 2) and periodically the sensor select by the push button and represented by the “eyes” were measured. If is lower then certain amount (see the code) the soil was dry and the plants need water and consequently you could see a “sad” face in the LED matrix. Otherwise, the soil was good and a happy face could see in the LED’s matrix.

Take a look in the pictures below. The first picture is sensor number 2 (two eyes) and the plant is happy, it means, has water enough in the first coup with soil. The second pictures (one eye) means sensor number 1 and the flower is sad, it means, the plant needs water.



Then the sad face, could tweet you asking for water! Of course it was a fair and I did not connect any eletric water valve because would be a mess and I would need to change the soil all the time. Another point is, if you want to create this system in your house, you do not need the LED matrix to draw the flower sad or happy face, you only need the nails connected to your analog ports and let your software make the decision, for example, turn on your sprinklers.

The code:

On this post I am adding the code to how the sensors are read and how the LED matrix is changed after reading the push button state. I will add a different post how to tweet using our ethernet connector or wifi pci-e module.

// Author: Manoel Carlos Ramon

#define DEBUG 0

/* Pins that define if system is ON */
#define PIN_LEFT_EYE 10
#define PIN_RIGHT_EYE 11

/* Sensor switch button */
int sensor_value = 0;

/* Moisture sensor - Analog Input */

/* The analog reading boundary when soil is good */
#define SOIL_IS_GOOD 350

/* some prototypes*/
void clear();
int current_system = 0;
int button_state = 0;
int last_button_state = 0;

int array_happy_face[2][4] = {{1, 0, 0, 1}, /* line 1 */
 {0, 1, 1, 0}}; /* line 0 */

int array_sad_face[2][4] = {{0, 1, 1, 0}, /* line 1 */
 {1, 0, 0, 1}}; /* line 0 */

 _____________ led 0 - pin 6
 | __________ led 1 = pin 7
 | | _______ led 2 = pin 8
 | | | ______ led 3 = pin 9
 | | | |

int array_serious_face[2][4] = {{1, 1, 1, 1}, /* line 1 */
 {1, 1, 1, 1}}; /* line 0 */

 ^ ^ ^ ^
 | | | |__ led 3 = pin 5
 | | |______ led 2 = pin 4
 | |________ led 1 = pin 3
 |____________ led 0 = pin 2

/* LED MAD */
 How the pins will work
pin 0 - Selects the common anode line 0
pin 1 - Selects the common anode line 1
int lastButtonState = LOW; // the previous reading from the input pin
long lastDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 50; // the debounce time; increase if the output flickers

void setup() {

 if (DEBUG) Serial.begin(9600);
 // put your setup code here, to run once:
 int pin = 0;
 for (pin = 0; pin < 12; pin++)
 pinMode(pin, OUTPUT);

 // switch button

// clear();


void clear()
 int pin = 0;
 for (pin = 0; pin < 12; pin++)
 digitalWrite(pin, LOW);

void drawMatrix(int array[2][4])
 int line = 0;
 int pin = 2;
 int c = 0;
 int level = LOW;

 while (line < 2)
 digitalWrite(line, LOW);

 while (c <= 3)

 level = array[line];
 if (DEBUG)

 digitalWrite(pin, level);
 /* if (DEBUG)

 digitalWrite(PIN_LEFT_EYE, HIGH);

 if (current_system != 0) digitalWrite(PIN_RIGHT_EYE, HIGH);


int checkButtonState()

 // read the state of the switch into a local variable:
 int reading = digitalRead(PIN_SWITCH_SYSTEM);

// check to see if you just pressed the button
 // (i.e. the input went from LOW to HIGH), and you've waited
 // long enough since the last press to ignore any noise:

// If the switch changed, due to noise or pressing:
 if (reading != lastButtonState) {
 // reset the debouncing timer
 lastDebounceTime = millis();

 if ((millis() - lastDebounceTime) > debounceDelay) {
 // whatever the reading is at, it's been there for longer
 // than the debounce delay, so take it as the actual current state:

// if the button state has changed:
 if (reading != button_state) {
 button_state = reading;


return button_state;
void loop() {

digitalWrite(0, LOW);

digitalWrite(1, LOW);
 // reading the sensor
 switch (current_system)
 case 0:
 sensor_value = analogRead(ANALOG_MOISTURE_SENSOR_1);

 case 1:
 sensor_value = analogRead(ANALOG_MOISTURE_SENSOR_2);

 if (DEBUG)

 Serial.print(" sensor_value:");

 if (sensor_value >= SOIL_IS_GOOD)

 // reading the button state
 button_state = digitalRead(PIN_SWITCH_SYSTEM);

 if( button_state == HIGH)
 // button pressed
 if (current_system > 1) current_system = 0;

 if (current_system == 0)
 digitalWrite(PIN_RIGHT_EYE, LOW);




The format is not so good but I am letting the code available to download here as well.

Next part I will post how to make the plants tweet you when they need water allowing them to communicate with you.

About Rome-Italy

One of most beautiful places I have been.. loved the place, the people and the food!!

110 thoughts on “Creating a soil moisture sensors using nails and Intel Galileo

  1. Pingback: nba 2k

  2. Pingback: slot games

  3. Pingback: nike sunray adjustable kids aluminum volt uk trainers

  4. Pingback: 褉芯蟹芯胁褘泄 泻芯褉懈褔薪械胁褘泄 nike kobe icon

  5. Pingback: vans abstract classic slip on womens uk trainers

  6. Pingback: jaune marron blanc superstar metal

  7. Pingback: adidas eqt support 93 17 grey by9511 uk trainers

  8. Pingback: bl氓 lilla nike air foamposite

  9. Pingback: nike roshe run 2014 nike roshe run mens

  10. Pingback: khaki volt dame nike air max 2017

  11. Pingback: caqui voltio adidas messi 16.1 fg

  12. Pingback: nike free 50 womens nike free 50 ext

  13. Pingback: uk trainers nike lunar elite sky hi city yellowish pink

  14. Pingback: nike air vapormax flyknit 2 racer bluetotal crimson 942842 400

  15. Pingback: hot sale acronym x nike air vapormax moc 2 black volt black aq0996 007 mens running shoes

  16. Pingback: urban adidas eqt running 93 primeknit

  17. Pingback: adidas zx flux limited edition adidas zx flux womens limited edition

  18. Pingback: concave aura+ fg black red soccer footwear

  19. Pingback: puma pwrwarm x packlite down jacket mens sport box

  20. Pingback: uk trainers adidas flip flops yellowish pink

  21. Pingback: jz80 supra mark 4 body new type lfa

  22. Pingback: 2017 5 colors newborn baby infant toddler girls boy children first walkers booties 0

  23. Pingback: nike free tr fit womens cool grey chlorine blue varsity maize 429785 101

  24. Pingback: nike lebron 15 wine burgundy navy blue

  25. Pingback: kids pro line jermon bushrod 74 new orleans saints jersey

  26. Pingback: blue beanie day adrian roselli

  27. Pingback: 2016airjordanshoes

  28. Pingback: all comes once a blue moon junior prom graduation plus dresses share light pink semi

  29. Pingback: under armour spotlight fg

  30. Pingback: chaussures ecco chaussures derby femme beige2018 nouvelle de derbies et richelieus

  31. Pingback: long sleeve and long dress

  32. Pingback: yuribobrikhin

  33. Pingback: puma avanti

  34. Pingback: philipp plein couture casual trouser black women trousers philipp plein t shirt new york

  35. Pingback: ac milan 1988 89 away retro jersey

  36. Pingback: is new red black puma evopower 3d vigor 2017 football boot

  37. Pingback: psg adult soccer tracksuit set 2018 2019 marseille tracksuit 18 19 fr paris mbappe football jogging jacket training suit psg tracksuit marseille tracksuit

  38. Pingback: estadi de la nova creu alta sabadell

  39. Pingback: to look shoes nike kobe a d aston martin

  40. Pingback: antonio valencia manchester united 18 19 authentic third jersey by adidas

  41. Pingback: adidas ace 17 tango purecontrol in by2226

  42. Pingback: victor oladipo t shirt wholesale

  43. Pingback: jersey chicago chicago wolves

  44. Pingback: adidas neo bc0065 boys cf race k sneaker

  45. Pingback: russell westbrooks jordan why not zer0.1 releasing in five new colorways

  46. Pingback: fucking x vans shoes

  47. Pingback: at k酶be for salg billig nike air presto 5 0 m忙nd sko brown nike roshe run

  48. Pingback: puma serbia home shorts for world cup 2018

  49. Pingback: oo937706 product 4

  50. Pingback: memory keychains diy arts and crafts easy diy crafts fun crafts crafts for

  51. Pingback: bluewaters apartments gold coast broadwater great location for the family 23 bedroom holiday accommodation on the broadwater queensland australia

  52. Pingback: the nike kd 6 the next model get the floral treatment as first suggest a series of lifecolorway of kevin durants sixth signature

  53. Pingback: air force 1 low ultra

  54. Pingback: nike air ace pro

  55. Pingback: baby boys red venture puffer jacket c9 by champion water wind resistant

  56. Pingback: photos simple braided hairstyles with weave black hairstle picture intended for braided hairstyles

  57. Pingback: festive off white converse women backpack converse backpacks bags

  58. Pingback: gold schwarz nike jordan why not zer0.1

  59. Pingback: texas longhorns football merchandise

  60. Pingback: sunglasses size of

  61. Pingback: converse chuck taylor all star kids low top pink stretch lace 619724

  62. Pingback: barrister s gown wig band set

  63. Pingback: the fala beanie hat knit kit for beginners the knit kit company

  64. Pingback: girls sweaters solid candy color boys sweaters autumn new knitted baby girls ribbed sweater kids clothing girls pullover

  65. Pingback: mens new shoes buy running football cycling cross training

  66. Pingback: any advice for aspiring skateboarders

  67. Pingback: nike blazer easter 18 ao2368 600 03

  68. Pingback: adidas terrex fast x gtx hiking shoes

  69. Pingback: womens gold high heel shoes

  70. Pingback: adidas voloomix men open toe synthetic gray slides sandal

  71. Pingback: old spice red zone swagger scent body wash for men 21 oz kick nike

  72. Pingback: great deals kickz boutique in jordan shoes ebay stores

  73. Pingback: nike air jordan retro 11 gamma blue size 8

  74. Pingback: new balance 96 revlite wrt96ma steel with angora casual shoes for women online

  75. Pingback: switch on off power button flex cable replacement for apple iphone 6 4.7

  76. Pingback: uniform design online thesporting

  77. Pingback: mizuno wave sky 2 mens running shoes

  78. Pingback: new balance m990 bk3 men

  79. Pingback: womens vintage hotel key fob

  80. Pingback: nike lebron 13 black blue

  81. Pingback: hat snapback iceland flag baseball women

  82. Pingback: philadelphia eagles youth nfl game stated full zip hooded sweatshirt gray

  83. Pingback: toddler shop

  84. Pingback: josmo baby boys lace up boot black

  85. Pingback: an american company toms shoes that matches every pair of shoes purchased with a new pair of shoes for a child in need has partnered with rotary richards

  86. Pingback: lifeline plain classic polo shirt in black online shopping promall philippines

  87. Pingback: adidas terrex swift r gtx gore tex mens waterproof walking hiking trail shoes t

  88. Pingback: prada shoes uk

  89. Pingback: supra atom light grey charcoal white

  90. Pingback: denim backpack repurposed jean jacket big bucket drawstring bag vintage 80s 90s grunge backpack hipster upcycled recycled laptop sleeve

  91. Pingback: full bootsjust below so acop limited edition tee right nowua shop

  92. Pingback: 2015 latest jordan retro 4 mens basketball shoes white blue 086

  93. Pingback: jordan phase 23 hoops ray allen home away pes sneakerfiles

  94. Pingback: nike zoom total 90

  95. Pingback: nude cotton checked shirt

  96. Pingback: 20 rabat p氓 hotelophold i danmark og sverige

  97. Pingback: element icon tree indigo backpack

  98. Pingback: boohoo blue jean skinny taille haute stretch bleu clair taille 6

  99. Pingback: right on 銉┿偆銉堛偑銉炽伄銉戙兗銈兗浜烘皸銉┿兂銈兂銈?銉°兂銈?zozotown

  100. Pingback: chaussures plates lanvin chaussures femme automne hiver

  101. Pingback: new balance mens 623 training shoes

  102. Pingback: buy new era adjustable trucker cap retro 5 panel white olive

  103. Pingback: damen klassische stiefel mit kuschelige f眉tterung gr.39 neu in sontheim

  104. Pingback: lebron xiii lebron xiii

  105. Pingback: christys hats kingsbury fur felt trilby hat with feather black

  106. Pingback: zdjcie vans tenis贸wki warszawa

  107. Pingback: uk trainers nike zoom cabos grey magnet

  108. Pingback: new balance sneakers regular article new balance m990 bk4 black d wise made in u.s.a men

  109. Pingback: vans 銉愩兂銈?銈搞儍銉椼儜銉笺偒銉?銈儍銈?銈广偊銈с儍銉?boys boneyard zip hood 鐢枫伄瀛?瑁忚捣姣?18鏂颁綔 120 130 140 150 160 170

  110. Pingback: sukienki rozmiar 42 sk ep vividstore p wroc艂aw

Leave a Reply