Project : FEZ PANDA II I2C

Hello everyone,

As part of an IT project, I am responsible to acquire data from a hive. (Weight, Temperature and battery voltage)

In fact I have an electronic scale with sensors (Weight, Temperature, Voltage) connected in conjunction I2c to my FEZ Panda II card that is connected via USB to the PC.

I’m not sure where to start, how to do really take and is it they are people who have already worked with such equipment, to make a very similar work.

:think: :think:

Welcome Boby2594

sounds an interesting project. I doubt anyone has an identical project, but you may find similarities and helpful pointers.

For starters, if you’re looking for tips, you might want to describe what the scale/sensor platform you’re using is (part numbers if possible, data sheet at a minimum) so others who are interested to help have some idea what you’re looking at. Beyond that, I’d also suggest you describe what you want to achieve - do you mean a beehive, sitting in a field somewhere? Does the Panda have to sit permanently with the hive ? Do you have power ? How do you expect to get the data to “home base” ? Thinking through these things and describing them here will mean any help we can give starts to become relevant, otherwise we could be randomly taking you in the wrong direction.

Whats the make and model of your scale? Add a link to the user manual. You would also probably want a GPRS module to get data when the hive is full to collect.

Thank you for your answer. :slight_smile:

Actually, I have an electronic hive hive making office. The idea is to get something sensors, that is to say, slave i2c component. My FEZ Panda II calculator is the master and I2C components are the slaves, the master must poll the i2c component (Slave) which has its own address that it responds to obtain information.

All you mentioned there was that the I2C devices are connected to the Panda - and that’s pretty simple to do so you should be right.

I don’t have user manual… And no GPRS module. JI just want to get the temperature measured by the panda calculator.
Master slave principle between the panda and I2C comosants

I can’t read the good temperature from the temperature wire, i have 59°C…

This is my code :

public void set_Temperature(byte Tmax, byte Tmin)
{

        MyI2C.Config = Temperature;
        xaction = new I2CDevice.I2CTransaction[1];
        byte[] data = new byte[5] { 0xA1, Tmax, 0xA2, Tmin, 0xEE }; 
        xaction[0] = I2CDevice.CreateWriteTransaction(data);
        MyI2C.Execute(xaction, 1500);

    }


    public double read_Temperature()
    {

        double realtemp = 0;
        MyI2C.Config = Temperature;
        xaction = new I2CDevice.I2CTransaction[2];
        byte[] data = new byte[1] { 0xAA }; 
        xaction[0] = I2CDevice.CreateWriteTransaction(data);
        byte[] ReturnedTemperature = new byte[2];
        xaction[1] = I2CDevice.CreateReadTransaction(ReturnedTemperature);
        MyI2C.Execute(xaction, 1500);

        if (ReturnedTemperature[0] >= 0 && ReturnedTemperature[0] <= 125) realtemp =             (double)ReturnedTemperature[0];
        else realtemp = 255 - (double)ReturnedTemperature[0];
        return realtemp;

    }

what temperature measurement device do you have ??

The result of this code is… 59° C

@ boby2594 - what happens if you read one byte less?

Mmh i think i already try this and didn’t work

you still haven’t said what the device is !

DS1621

step 1: refer to https://www.ghielectronics.com/docs/12/i2c to see how to check the return of the i2c Execute() call. You don’t know if it is communicating to the chip or not.

step 2: tell us about your A0/A1/A2 lines and how they’re set.