How to use DFRobot sensors with MicroBit
This is a documentation about how to make a sensor work using microbit and doing an easy task with it (like showing the information or switching the led screen).
Also the idiea is work with the Kitronic Robotics board shield.
Materials needed
- Microbit
- Kitronik Compact All-in-one Robotics Board for bbc microbit
- Analog resistance type soil moisteure sensor dfrobot SEN0114
Preparation
Check that you're able to upload some programs to the microbit using makecode. This is not covered by this documentation.
How to install the extension of the kitronik board
You don't need this extension for the sensor to work but I show because it's relevant for the motors and the project about it.
Once we are in the project
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
We go to the wheel of settings and click "Extensions"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
There we look for "Kitronik robotics"
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
And we click kitronik-robotics-board
If you have it properly installed you should see this:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
The sensor itself
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
https://wiki.dfrobot.com/Moisture_Sensor__SKU_SEN0114_
The sensor has 3 pins, Ground (GND), 3V3 and any reading pin
You can see the pinout here:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
From the website:
ββββPower supply: 3.3v or 5v
ββββOutput voltage signal: 0~4.2v
ββββCurrent: 35mA
ββββPin definition:
ββββ Analog output(Blue wire)
ββββ GND(Black wire)
ββββ Power(Red wire)
ββββSize: 60x20x5mm
ββββValue range:
ββββ 0 ~300 : dry soil
ββββ 300~700 : humid soil
ββββ 700~950 : in water
The connection
We use the cable that comes and we use solid wire to connect it to the board.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
It's easy to do a simple hinge wit the solid wires and that's why I suggest to use for the simple projec rather than a dupont cable.
Here you can see the hinges
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Then we have to use Analog Read in our code
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Sample code with microbit
This is a sample code using the specifications from the website, in this case we have the led screen changing
In photos
This is alone (dry)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
And here when you touch both pads with water in your fingers (humid)
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More β
Yet another moisture sensor
Asair DHT11
https://naylampmechatronics.com/blog/40_tutorial-sensor-de-temperatura-y-humedad-dht11-y-dht22.html