TinyScreen+ and 9-DOF Chip

korion2525

  • Newbie
  • *
    • Posts: 1
    • View Profile
Hello!

I am trying to get the 9-DOF chip working with the TinyScreen+ but I cannot compile it. The problem lies in that the 9DoF code uses EEPROM and the Zero doesn't have an EEPROM. Is there a workaround for this? The same error would occur if you were to use the new 9  DoF chip TinyCircuits released. Would you also have issues running I2C on the Zero?

Thoughts? Thanks!



Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 357
    • View Profile
Since we only have a limited release of TS+ with OWatch, we don't have everything fully supported yet.

EEPROM is sticky- nobody else has tackled it that I can find, so I plan to work on emulation(EEPROM wrapper for writing to flash) code for the Zero- this is somewhat non-trivial to get right.

Short term, you may have to remove references to EEPROM in the IMU library and not use or hard code calibration for the magnetometer.

I2C is fine through the Wire library as far as I know, although there could still be bugs. However, now that I think about it, the IMU library uses an external I2C library, probably only intended for AVR.. This is getting ugly, I'll take a look at it ASAP :)

Thanks,
Ben


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 357
    • View Profile
Minus EEPROM, I was actually able to get the library seemingly functional on both platforms and both sensors pretty quickly. Would you mind giving this a test? I've 'Arduinofied' the library a bit, and everything is contained in the single folder with examples. You should be able to delete/move all the old stuff(I2Cdev, callib, etc). I've changed things to work with Wire directly rather than I2Cdev- seems to work. Let me know what you find :)


Grimstone

  • Sr. Member
  • ****
    • Posts: 64
  • Still downloading...
    • View Profile
I cannot seem to find anything in the lib for the embedded temperature sensor on it. Any sample code for that around?


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 357
    • View Profile
A quick search turns up enough to paste this together, should work if RTIMULib is running:

Code: [Select]
float LSM9DS1getTemp(){
  uint8_t temp[2]; // We'll read two bytes from the temperature sensor into temp
  Wire.beginTransmission(0x6a);//LSM9DS1_ADDRESS0
  Wire.write(0x15);//LSM9DS1_OUT_TEMP_L
  Wire.endTransmission();
  Wire.requestFrom(0x6a, 2);
  temp[0]=Wire.read();
  temp[1]=Wire.read();
  int16_t temperature = (((int16_t) temp[1] << 12) | temp[0] << 4 ) >> 4; // Temperature is a 12-bit signed integer
  long temperatureHundredths = (temperature * 100)/16 + (25 * 100);
  float temp = temperatureHundredths/100.0
  return temp;
}

The offset constant of 25 could change depending on the sensor. It's probably not a very accurate temperature sensor.

I've also attached an updated version of RTIMULib with a really early test version of an EEPROM library for TS+/Arduino Zero. It does NOT do any wear leveling and does byte by byte flash writes- it will wear out the flash pretty fast. As well, it will change a fuse to allocate the last 16KB of flash for this purpose. Otherwise, RTIMULib can then work the same on TS+/TinyDuino.


 

SMF spam blocked by CleanTalk