You can use T3.5 SD card.
However, If you have not done yet, I would connect first a single sensor (I assume Ultra sonic sensors are 40 kHz distance sensors)
to Teensy, interface with sensor and write data via usb-serial to PC, If that is working, add another sensor and increase slowly the complexity.
If all sensors are working to your satisfaction and you have thought about what type of info you wanted to write to sdCard, take the one of the logger examples in Teensyduino/Arduino and adapt to your sensor suite.
If you encounter problems, please post the complete code you are using, the sensor models with detailed connection to teensy, so we can help you.
I have integrated all those sensors in an arduino mega board right now but wanted to change to the teensy board.
As a start I integrated one Lidar lite V3 sensor and its working well with the board . Im able to write data via usb-serial to PC too.
Also I got the example TeensySdioDemo working too. Its writing some randomly generated data ( still trying to understand that code as im not a great coder myslef
) to the SD card in Teensy with a file name TeensyDemo.bin . I am trying to use the same program and try to write the sensor readings to a text file ( similar a usb data logger ) but i'm kinda having problems when trying to edit the code. Lidar lite use I2C protocol and this is the code that will give the readings from the sensor.
#include <Wire.h>
float measure();
byte lidarliteAddress=0x62;
byte distance_data[2];
int busy_flag;
void setup()
{
Wire.begin();
Serial.begin(115200);
}
float measure ()
{
Wire.beginTransmission(lidarliteAddress);
Wire.write(0x00);
Wire.write(0x04);
Wire.endTransmission();
Wire.beginTransmission(lidarliteAddress);
Wire.write(0x01);
Wire.endTransmission();
do
{
Wire.requestFrom(lidarliteAddress,1);
busy_flag= bitRead(Wire.read(),0);
} while(busy_flag!=0);
if(busy_flag==0)
{
Wire.beginTransmission(lidarliteAddress);
Wire.write(0x8f);
Wire.endTransmission();
Wire.requestFrom(lidarliteAddress,2);
int count =0;
while(Wire.available())
{
distance_data[count]=Wire.read();
count++;
}
float distance=((distance_data[0]<<8)+distance_data[1]);
return distance;
}
}
void loop()
{
float distance=measure();
Serial.println(distance);
}
I want to write that distance value to the SD card directly . Can you show me a way to edit the " teensysdiodemo " to write this distance to the SD card .
Note : The project aim is to put this sensor assembly on a hexa-copter and try to map the surroundings from the sensor readings . If I can get one's data to the SD card then I can figure out about the rest of the sensors I believe.
Thanks in advance.