Artificial Intelligence of my Arduino consists so far of a single soft (programmed) neuron, which I can teach and leave my pot flowers' irrigation in the trust of.

In this instructable we are going to implement an artificial neuron into Arduino. I visited a whole class :) of neurology course, so I can explain it's functioning to you in detail.

A neuron is a unit making decision on the basis of synapse signal (input 0-1) and a weight (importance) of this signal. Say we have a neuron whose synapse is coming from a soil moisture sensor. Weight (excitation threshold) is the level of the signal by which a neuron knows that the soil is dry enough and needs watering.

But every flower has its own comfortable moisture level. That's where a backpropagation can be implemented. By manually watering the flower pot we instruct our neuron what should be the weight of the signal or excitation threshold.

Now you know almost everything a certified neurologist knows about your brains.

Step 1: ​How Can We Put This in Practice?

Simple. We use quantum computing of the neuron coherent state linear superposition...

Just kidding! No, we use:

You just wire everything to Arduino's pins according to the diagram in this step.

I added 4 digit LED inicator to show current moisture level

  • pin SCLK = 7; // CLOCK
  • pin RCLK = 6; // LATCH
  • pin DIO = 5; // DATA and GND

*I modified a soil moisture sensor by replacing it's copper probes with 5cm long stainless steel rods to prevent them from decay due to galvanizing (see pic).

Step 2: Arduino Sketch

Upload the sketch into your Uno and power it up.

To make the process more obvious I added a 7 segment 4 digit LED indicator.

It is indicating current moisture level in relative units (0-255, actually about 40-150). Learned threshold is indicated to COM port monitor of Arduino IDE.

Step 3: ​Learning

When you assembled the station you need to teach it the moisture level it should maintain. Learning is the most crucial for this project!

I upgraded my neuron so it can learn anytime. Anytime when the pot had been watered not by the neuron itself, it understands that that was teaching and remembers the moisture threshold.

You should find the exact soil moisture the flowers must be watered at. And simply add water. Teaching done!

If you need to re-teach the neuron, just pour some water into the pot again manually. I mean let the soil dry to the condition you (or you think your flower) desire and add water. In some cases you will have to disconnect the water tank if you want to teach it drier threshold.

It was one neuron with two synapses. Imagine our brain with 86 billion neurons each having 1000 to 10 000 synapses!

<p>Cool! I'm running a similar project (early stage) but would like to use latching solenoid to limit wiring in my garden. Has anyone any idea where can I find a latching 1/2-3/4&quot; plastic valve for a reasonable price? </p>
<p>Maybe something like this one:</p><p><a href="http://aliexpress.com/item/J34-Free-Shipping-New-DC-12V-Electric-Solenoid-Valve-Magnetic-N-C-Water-Air-Inlet-Flow/32581664427.html" rel="nofollow">http://aliexpress.com/item/J34-Free-Shipping-New-D...</a> </p><p>Will it do?</p>
<p>Very interesting project. In code the #define can be replaced with const, right? But can uint8_t be replaced with byte?</p>
<p>As far as I understand you're right. I'm not a C++ artisan, so I can't judge which way is more memory/processor efficient. If you explained the difference I would appreciate it indeed. Thank you!</p>
<p>I'm not a guru and just ask this because I can't find in the Arduino Reference command: uint8_t.</p><p>Does it mean that that in this project we want to store into EEPROM a data that occupies just one byte?</p>
<p>Exactly. uint8_t</p><p>u - unsigned</p><p>int - integer</p><p>8 - number of bits</p><p>_t - means it's not macros, not function, not procedure, but type</p>
<p>Hi, I&acute;ve built the project, however I don&acute;t really understand the meaning of the sounds and color led.</p><p>Can you also explain a bit more, the modification you did the the moisture probe, mine has GND, VCC and SIGNAL however in the picture only two wires are shown,</p>
<p>The color led. In current version of the sketch color indicates the moisture level</p><p><em><strong>- Bluish - moist</strong></em></p><p><em><strong>- Yellow and orange - average<br></strong></em></p><p><em><strong>- Red - dry</strong></em></p><p>The more blue - the more moist the soil, the more red - the drier.</p><p>Sounds.</p><p>It makes sounds when <em><strong>pumping water</strong></em> - you can always disable it, I used it for debugging. Just place two slashes (//) in the beginning of line 134 ( playPump(pump); // pumping for seconds) or just delete the line.</p><p>It makes descending alarm sound when water <em><strong>tank is empty</strong></em>. You'd better leave it, it will remind you to fill the tank.</p><p><strong>Moisture sensor</strong> was once like on picture here, but in my previous project it's probe was eaten out by galvanization within one week (see pic.2). What I did after. I replaced a probe having hieroglyphs with hand-made you can see in the article. It only has two wires which go to the small board with another 4 pins. They are VCC, GND, DO (digital), AO (analogue). I used analogue output along with VCC and GND.</p>
<p>thank you!!!</p>
<p>Thanks for the upgraded neuron!</p>
<p>Also, I do not understand this line:</p><p>if (soilValue &gt; setValue) // current &lt; eeprom, run the pump</p><p>If setValue is the value stored in eeprom, then the code </p><p>is not it supposed to be:</p><p>if (soilValue &lt; setValue) // current &lt; eeprom, run the pump</p><p>??</p>
<p>You're right. The comment (after //) to this line is ambiguous. It should better be:</p><p>// if current (dryness) &gt; eeprom value, run the pump</p>
<p>Actually soilValue is a dryness parameter not moisture. The sensor is made that way. The more dry the soil the higher the value. That's why when it becomes more than set value we have to start the pump.</p>
Отлично. Думаю ардуино нано полойдет?
<p>Great! Congratulations!!</p>
Thanks :)
<p>Great project - what software did you use for neuron emulation?</p>
<p>He provided the software as downloadable code.</p><p><a href="https://www.instructables.com/files/orig/F69/8FX0/IQFHIXWT/F698FX0IQFHIXWT.ino" rel="nofollow">Soil_Moisture_Teachable_1.ino<br> <br> </a></p>
<p>Great project - what software did you use for neuron emulation?</p>
<p>He provided the software as downloadable code. </p><p><a href="https://www.instructables.com/files/orig/F69/8FX0/IQFHIXWT/F698FX0IQFHIXWT.ino" rel="nofollow">Soil_Moisture_Teachable_1.ino<br> <br> <br></a></p>
Nice work! I am planning to implement something similar, using ESP8266 to log humidity in a raspi server, and also try to implement some level control for the tank to warn me when it is empty and need a refill. Congratulations!
<p>It's also a great idea. I made something of a kind in my previous instructable <a href="https://www.instructables.com/id/Wireless-Home-Cloud-for-the-Crowd/">Wireless Home cloud</a>. ESP8266 with DHT sensor is sending parameters to mysql server on OpenWRT router. Then I display them on the graphs. </p>
<p>Great project - what software did you use for neuron emulation?</p>
<p>Thank you! </p><p>Arduino IDE utilizes C++. The sketch is enclosed with the instructable.</p>
<p>Estou muito interessado na rede Neural Usada para dar intelig&ecirc;ncia ao seu sistema.</p>
<p>Thanks! I installed this one at the bottom of the tank: http://ru.aliexpress.com/item/1pc-Tank-Pool-Water-Level-Liquid-Sensor-Float-Switch-Brand-New/32581638779.html</p>
<p>Nice project,what is the model of water level sensor module?</p>
<p>Nice project,what is the model of water level sensor module?</p>

About This Instructable




More by AlexanderTRU:Remote Controlled Floor Lamp Distant boiler temperature monitoring AI on Arduino (learning Irrigation Station) 
Add instructable to: