Microsoft MakeCode

DS18B20 Temp sensor in MakeCode Maker

Hello! This is a very specific question but I would really appreciate any help or advice:

I want to work with the temp sensor “DS18B20” in MakeCode Maker. I found an extension (https://github.com/DFRobot/pxt-ds18b20) but only works for MakeCode Microbit. Does anyone know how can I make it work in MakeCode Maker?

When I add that extension and try to download the code to the board I got the error:
"The hex file is not available, please connect to internet and try again."

I guess there is a hex/uf2 files conflict cause MicroBit uses hex files and for my board, in MakeCode Maker, I need the UF2 file, any idea about how could I make it work?

Thank you for your time!

Generally I have to choose a board type before starting to write code in Maker. I think if Adafruit CPX is going to be used then I would not need to add a temp sensor extension because it is built in. If I choose Metro then I am given the extension for temperature , as shown below, and the DFRobot Microbit extension is not needed. If I do install that extension in Maker but do not call any code it still breaks the compiler, maybe due to the .hex underlying programming in the extension ? I might suggest trying the below program but I do not know if you are using Metro or something like it: https://makecode.com/_9kj9H5Eq6X8Y

1 Like

Thank you for your answer @frank_schmidt.
We are building a PCR Thermocycler and the goal is to run it with MakeCode blocks. For this machine it’s required to have an external temperature sensor that must be placed in a very specific spot, so we can not use the one integrated on the board.
We have two boards we can work with, Adafruit Grand Central and Adafruit M4 feather Express.
I think the solution would be to modify the https://github.com/DFRobot/pxt-ds18b20 extension to make it work for any of our boards. However, I’m not sure how difficult this task would be or how should I start. Any thoughts?
Thank you,
David

Are you intending to use an “Arduino” type of sensor for temp? Can you give the hardware type and number? If I have one then I can wire it to an M4 board and try the temp extension for that board; I would not use an on-board sensor but one externally wired if I knew what sensor you are using. I have no idea how to modify an extension from .hex to .one that would work with Arcade. There is a built-in temp sensor on the Meowbit which is programmed in Arcade. Would it help to see that underlying code ? Here’s the github link: https://github.com/KittenBot/meowbit-tutorials/blob/master/more/About%20Meowbit%20.md Please let me know what temp. sensor hardware you are planning to use.

1 Like

I may be mis-understanding what you are trying to do @Dwagga , The handiest Adafruit M4 board that I had is the ItsyBitsy M4 Express. I have not tried this code on my MetroM4 Express but I would think it would work just the same. I just said, analog read the temp to A1 and if the temp is above ‘X’ then turn on the green led on pin 7. I changed the named temp number several times above and below room temp and the LED did turn on when designated temp was set below room temp. The temperature extension installs on all the M4 boards environments that I have and does compile. The code with extension in Maker: https://makecode.com/_Xvy38gAER7vU

Thank you again @frank_schmidt!
Exactly, we need an externally wired temp sensor for our project and, as you said, it must be an “Arduino” type of temp sensor. We have a “DS18B20” temp sensor, which is very appropriated for our PCR machine.
Thanks for sharing the Meowbit link, however, notice that since we are working in MakeCode Maker and not in MakeCode Arcade, the kind of file we need is a (.uf2) instead of a (.one) file.
I would like to make clear that we do not want to create blocks for the user to grab and control the temp sensor but the functions to read the temperature through the DS18B20 sensor (somehow behind the blocks).
Thank you so much!