TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: korion2525 on April 04, 2016, 11:18:15 AM

Title: TinyScreen+ and 9-DOF Chip
Post by: korion2525 on April 04, 2016, 11:18:15 AM

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!

Title: Re: TinyScreen+ and 9-DOF Chip
Post by: Ben Rose on April 04, 2016, 09:16:53 PM
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 :)

Title: Re: TinyScreen+ and 9-DOF Chip
Post by: Ben Rose on April 05, 2016, 08:31:18 PM
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 :)
Title: Re: TinyScreen+ and 9-DOF Chip
Post by: Grimstone on June 10, 2016, 10:33:21 PM
I cannot seem to find anything in the lib for the embedded temperature sensor on it. Any sample code for that around?
Title: Re: TinyScreen+ and 9-DOF Chip
Post by: Ben Rose on June 13, 2016, 07:48:28 PM
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.requestFrom(0x6a, 2);
  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.