This is a small thermometer made with a temperature sensor linked to your micro:bit. In this tutorial you will learn how to make an analogue measuring device, I mean convert the sensor voltage to a degree Celsius temperature.
Things you will need:
• A 3D printer
• 1 micro:bit device and battery pack
• Filament (plastic) for your 3D printer
• 1 temperature sensor : TMP36
• Banana cable
Step 1: Printing Parts
· To obtain the 3D files push the download button on this page !
· Next you will have to slice the parts: that means generate a code, representative of your 3D part which your printer will be able to understand. This action is called "slicing" because your printer prints the part layer by layer, so you need to slice your object into many digital layers. You will need to use the right slicer for your 3D printer, ask your teacher if you need help with this!
· The most important setting for the printer is the temperature of the nozzle, which will depend on the type of filament you use, the speed, the infill, the layer height, and whether you need support or not will also need to be considered.
· Print the thermometer with a regular filament, 20% infill and 0.2mm layer height. It's better to print it with support but if you have a printer with a filament cooling fan then it will work without support.
Export your code to your SD card and take it over to the printer! J
Step 2: Flash your micro:bit
You can find the code here
· Vpin represents the voltage, in millivolts, which the micro:bit reads on the P0 pin.
The analog read function returns 1023 if the voltage is about 3V (The actual voltage was 2.85V for me), so to convert the returning of the analog read function in a voltage in millivolts, we multiply it by the maximum of voltage (2850mV) and divide it by the maximum of the analog read function.
· Now we have to convert this voltage to a temperature in degrees Celsius. Referring to the datasheet of the temperature sensor (TMP36), we know that 25°C corresponds to 750mV, and that increases by 10mV each degree. So by resolving the equation: Vpin(mV)= A*T(°C)+B you will find T(°C)=(Vpin-500)/10.
· We finally display our measurement on the screen, and restart it 2s later, this is because we can be fairly certain the temperature will not vary significantly within 2 seconds.
Step 3: Assemble the Parts
First put the battery in. Use a small piece of double side tape to hold the sensor in its place.
Then plug the micro:bit to the battery and put it into the thermometer.
Step 4: Link the sensor
Link the PIN 1 to 3V output, PIN 2 to P0, PIN 3 to GND.
Plug the banana cable to the micro:bit, you can use crocodile cable on the other side. You can also solder the wires.