Main Site Documentation

EBlock thermometer with Gadgeteer spider



I am new to gadgeteer & this forum, I am trying to create an eBlock thermometer.
I have attached my eblock to socket 9 on the spider board.

Here is the code I am using to display the readings in a glide textblock.

        static GT.Interfaces.AnalogInput eBlockThermometerIn;
        static GHIElectronics.NETMF.Glide.UI.TextBlock textBlockTemperature;
        void ProgramStarted()
            Debug.Print("Program Started");
            GT.Timer timer = new GT.Timer(1000);
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            //Setting the analog input pin for Thermometer
            eBlockThermometerIn = eBlockExpansion.SetupAnalogInput(GT.Socket.Pin.Three);

            //Get the TextBox
            textBlockTemperature = (GHIElectronics.NETMF.Glide.UI.TextBlock)window.GetChildByName("TextBlockTemperature");
        void timer_Tick(GT.Timer timer)
            textBlockTemperature.Text = (eBlockThermometerIn.ReadProportion()).ToString();

With this code I am able to see some voltage readings on the screen every second.

Please help me to convert these voltage readings to meaningful temperatures.



Welcome to the forum!

With the ReadProportion method, you get a value on normalized scale [0;1].
The temperature scale in Celsius for that sensor is [-22;56]. So the measurement value in Celsius will be:

double normalizedValue = eBlockThermometerIn.ReadProportion();
double tempC = -22 + normalizedValue * 78;

Here is a link for non-Gadgeteer driver for that sensor. You can find conversion formula for Fahrenheit there.


Since this eblock is expecting 5volts, you need to adjust the scale as well as the FEZ Spider analog inputs are 3.3v. Adjusting the line below yields the proper temperature

double normalizedValue = ((double)5 / 3.3) * adc.ReadProportion();


I know. :slight_smile: I found this topic for something else I was doing and noticed it didn’t work…exactly. Just thought I’d share some goodness and save someone from pulling their hair out.


@ ryanb - You are adjusting the value after it has been read. you are not adjusting analog input value. Btw the eBlock extension module can provide 3V3 or 5V to power an eBlock, there is a switch on the module.


@ Architect – I know I am adjusting the value after it is read. I do not have an eBlock extension module (cannot find them for sale anyplace). My Panda had a 5 volt signal where-as the Spider is 3.3. Using the original formula, the temperature is DRASTICALLY off unless this correct is applied. (My sensor isn’t defective – it works perfectly well on my Panda still with the original driver. I was not able to obtain readings even close to the Panda on the spider until I applied this software correction)