Teensy 3.0 driving 9-DOF accelerometer?

Status
Not open for further replies.
There are 4 card formats, called SD/FAT12, SD/FAT16, SDHC and SDXC. All use the same hardware, but each needs different software support because the filesystem data on the disk is different.

I believe Bill's SdFat library and the Arduino SD library (which is based on an older version of Bill's code) supports 2 of these: SD/FAT16 and SDHC.

SD/FAT12 is usually used on tiny cards, typically 32 megabytes or less, though in theory it can be used up to 128M.

SD/FAT16 is used on small cards, from 64 megabytes to 2 gigabytes.

SDHC is used on most modern cards, from 4 to 32 gigabytes.

SDXC is used on large cards, above 64 gigabytes and larger.

You might be able to make a SDXC card work, maybe, if you reformat it using FAT32 filesystem? My understanding is the problem isn't the card's hardware, which is pretty much identical to SDHC, but the filesystem format on the disk.

By default, Microsoft's tools will not format volumes larger than 32 gigs with FAT32, even though FAT32 can support extremely large disks. I believe there are 2, maybe 3 reasons. #1: Apparently some versions of Windows had a bad bug in their check disk program for FAT32 over 32 gigs. Microsoft "fixed" the problem by not allowing disks over 32G to be formatted with FAT32. #2: Some drivers don't support cluster sizes more than 32 kbytes (I know the drivers in Vista & Win7-8 do), but some drivers become slow and inefficient when dealing with disks that have a very large number of clusters. The 32 GB limit was probably a compromise to prevent filesystems with more than 1 million clusters which would be slow to use on many versions of Windows. #3: Microsoft might have some patents covering stuff in the newer format, meaning they can collect royalties or exert more control over the market? (I really don't know if this last point is true or valid, it might be just a rumor by anti-Microsoft haters)

The "mkdosfs" program on Linux can format any very large disks as FAT32. I've personally done this on a couple large hard drives, which seemed to work fine with used with Windows XP.

I have not personally tested cards larger than 32G. So far, I do not own any 64G cards. I have tested a few 32G and 16G cards, which worked fine.
 
Thank you. I will check out the examples. I am still waiting for the boards to arrive in the mail.
Look at the example sketches (like I said there's a lot). You can just copy/paste what you need out of there.
I'm sure there's a logging example. I use mine for storing binary data as fast as possible.
 
Very excited to see your progress Space...have a project in the pipeline where I need to measure body angles and save to an SD card. If you figure it all out, then will be a lot easier for me :)
 
Sure I will be very happy to share my experience. I am still waiting for the SD card adaptor to arrive.
 
Hi Paul,

Thank you for the detailed post. Please could you help me why the Teensy 3.0 is not able to save to a Open Log (Open Log is a atmega 328 P based micro sd card adaptor). I am using a 16 GB micro SD card.
 
Please could you help me why the Teensy 3.0 is not able to save to a Open Log (Open Log is a atmega 328 P based micro sd card adaptor). I am using a 16 GB micro SD card.

Maybe I can help. It's not a PJRC product, so there's only so much I can do.....

Could you post a link to this product's info, and (hopefully small) sample code which demonstrates the problem?
 
Hello,

for your OpenLog problem I have this idea: You said that you connected the OpenLog to Rx and Tx. The Teensy 3 does not have Rx and Tx pins, instead there are RX1-TX1, RX2-TX2, and RX3-TX3. So if you connect the OpenLog to for example TX1 you have to start and write to Serial1. If you write to Serial, it will be the serial console. It is the same procedure for any serial device (GPS, XBee, etc...) connected to the Teensy.
 
Indeed there are lots of reasons why it might not be working. 1.14 has a problem with Serial2 and Serial3 (I'm going to publish 1.15 soon with this fixed), so use Serial1 for now or use these files to fix it. You didn't mention which version of the software you're using, so we can't know if this might be the problem.

The wires need to be connected properly, but we can't see your wiring because you did not post a photo. Your code needs to be right, but we can't see the code you're using to test. It's impossible to know why this isn't working for you.

These types of "help my get something working, but I'm not going to give you any information" questions really aren't a very effective way to ask for help. I can't do much to really help, AND it takes more of my time to write out not-very-useful answers like this one, where I try to guess multiple things that *might* be wrong. It's frustrating, because I can't help and it takes away time from doing more useful things. Please, if you're going to ask for help troubleshooting stuff, please invest a little more effort to post enough info about what you've actually done so everyone here can see and try to help. Is that so much to ask?
 
Hi Paul,

When I disconnect the Teensy 3.0 from the computer and reconnect it back then why do the programmes stop running. I do not get any reading on the serial monitor. Even when I press the reset button I still do not get any reading on the serial monitor except zeros. Moreover when I press the reset button then COM port is no longer visible on the Arduino IDE. Please help me resolve these problems.

@ Space: Is this problem fixed? I have the same problem.

I am using my teensy 3.1 to read data from the MPU6050. After I upload it, it reads out the data fine, but when I unpower it and put the power back on it reads only zeros. This does not happen with my arduino nano, the nano always reads the values fine.

I used the libraries of both Jeff Rowberg and of Fabio Varesano (r49).

I have also used external pull ups between SDA, SCL and 3.3V, I tried 2k2, 4k7 and 10k resistors but it didn't help. I then bought another teensy 3.1 but the same problem occurs with this new board. I also have two different MPU6050 breakout boards: the gy-521 and the SEN-11028 from sparkfun, my teensy has the same problem with both of them.

The strange thing is that it does work but only if I load the program, not when just putting the power back on. I also tested the difference between USB and an external power source of 5v but no luck there. I know that because I tested it in combination with a motorcontoller and the motors where not doing anything after I put the power on, they only work after I uploaded the program. Occasionally when the program does run it suddenly stops reading the data, also re-uploading the program sometimes takes many tries before it runs. This does not happen with other programs.

I have to get this going because I don't want to use my laptop every time to start up my prototype. Does anyone know the solution? I will be very grateful!
 
I tested with a FreeIMU version 4 board about a year ago and it worked fine. I could dig it up and retest.

The strange thing is that it does work but only if I load the program, not when just putting the power back on.

How are you observing the results? Is this with the Arduino Serial Monitor? You didn't post the code you're using or reference a specific example from the library.

Does anyone know the solution? I will be very grateful!

I want to help you. But do to so, I need more specific info about exactly what you're doing. Please read these guidelines.

http://forum.pjrc.com/threads/15136-Please-Post-Code-amp-Details-In-Your-Question!
 
I tested with the MPU6050_raw example and used the serial monitor of arduino. I also used this code for a motor control sketch. When not powered over usb the idle motors tell me that the gyro is only producing zero's again.
After I push the reset button however the gyro readouts are fine again.
 
I just tried MPU6050_raw on a FreeIMU board and I was able to reproduce the problem.

I believe the bug is due to the MPU6050 chip not being ready when accelgyro.initialize() is called, and accelgyro.initialize() isn't designed for a board that boots up rapidly like Teensy 3.1.

I found adding a breif delay before accelgyro.initialize() solves the problem. Here's what I used:

Code:
    delay(10);
    // initialize device
    Serial.println("Initializing I2C devices...");
    accelgyro.initialize();

Unfortunately, I'm not really familiar with MPU6050 or this library, so this is the best I can do.

You might need more than 10 ms, depending on your chip and power supply startup.
 
You are a god.

Thank you so much Paul! That solved the problem, the gyro always produces readouts now.
 
Status
Not open for further replies.
Back
Top