ROBOTC.net forums
http://robotc.net/forums/

Hitechnic SMUX
http://robotc.net/forums/viewtopic.php?f=41&t=10592
Page 1 of 1

Author:  smallkitten [ Sat Feb 28, 2015 5:06 pm ]
Post subject:  Hitechnic SMUX

We would like to use the Hitechnic SMUX with a few mindsensors sensors. We now understand that it is only geared to NXT sensors and Hitechnic sensors, but we are using a mindsensors IMU and SumoEyes. Is it possible to integrate the multiplexer with other 3rd party sensors?

-smallkitten

Author:  mightor [ Sun Mar 01, 2015 2:35 am ]
Post subject:  Re: Hitechnic SMUX

Yes, it is possible for quite a few 3rd party sensors. I just never did :)

Basically, it can be done for any I2C sensor that does not require a configuration sequence and has a sane default mode. This is because you cannot write to an I2C sensor via the HT Sensor MUX, you can only configure it to read N bytes at register R at address A. Most normal analogue sensors can be read as well. Keep in mind that EV3 sensors will not work with the SMUX, neither will sensors that rely on the RS485 functionality that the NXT has.

= Xander

Author:  smallkitten [ Sun Mar 01, 2015 11:58 am ]
Post subject:  Re: Hitechnic SMUX

Thanks for the reply! We went over some of your test programs and header files but we are not sure if they need configuring. We are using the the mindsensors IMU, Pressure, and SumoEyes sensors, are they compatible? We are not experienced coders, but this was our first test:

Code:
//Test for Complemantary Filter
#pragma config(Sensor, S2,     HTSMUX,              sensorI2CCustom)

#include "hitechnic-sensormux.h"
#include "mindsensors-imu.h"
const tMUXSensor MSIMU = msensor_S2_1;

task main()
{
   int acc_x_val, acc_y_val, acc_z_val;
   int gyro_x_val, gyro_y_val, gyro_z_val;
   int dt = 0.01;

   while(true) {
      // Read the Gyroscope
    MSIMUreadGyroAxes(MSIMU, acc_x_val, acc_y_val, acc_z_val);

      // Read the Accelerometer
      MSIMUreadAccelAxes(MSIMU, gyro_x_val, gyro_y_val, gyro_z_val);

      //Math
      int angle = 0.98 * (gyro_x_val * dt) + (0.02) * acc_x_val;
      nxtDisplayTextLine(1, "%d", angle);
      wait1Msec(50);
   }
}

These were the errors we got:
Code:
File "IMUComplementaryFilterSMUX.c" compiled on Mar 01 2015 10:55:51
**Error**:Expression does not fit parameter. Call to 'MSIMUreadGyroAxes'. Parameter: 'tSensors link' is 'MSIMU' of type 'tMUXSensor'.
**Error**:Expression does not fit parameter. Call to 'MSIMUreadAccelAxes'. Parameter: 'tSensors link' is 'MSIMU' of type 'tMUXSensor'.


Thanks for your help!
-smallkiten

Author:  mightor [ Sun Mar 01, 2015 12:08 pm ]
Post subject:  Re: Hitechnic SMUX

Hey there,

Well, it won't work until someone writes the code to make it work with the SMUX and that hasn't happened yet :)

= Xander

Author:  smallkitten [ Sun Mar 01, 2015 12:12 pm ]
Post subject:  Re: Hitechnic SMUX

Ok thanks! If those sensors don't work for now we will have to revise our plans again. :)
Thanks for all of you help!
-smallkitten

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/