Introduction: AI on Arduino (learning Irrigation Station)
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:
- Arduino Uno,
- moisture sensor (upgraded*),
- water level sensor,
- water pump,
- relay a transistor would also suit,
- rgb LED, (optional)
- 4 digit LED indicator (optional)
- small tubing with T couplings and spray nozzles from car windshield washer
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!