Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 7 months ago.
Help me decide to choose u-blox C027. Few questions.
1. I need to store data for last few hours. What are the option to add SD card slot?
2. What type of CAN interface available? I need to connect to ODB II port on my car. Is there a readily available convertor cable which I can purchase?
3. Does it support LuaJit/eLua(http://www.eluaproject.net )?
4. Any warranty on the kit/components?
5. I assume GSM/GPRS support T-Mobile in USA.
6. can I connect it to Raspberry Pi/BeagleBone to offload some of the processing (encrypting data) before sending over GPRS?
Question relating to:
1 Answer
10 years, 7 months ago.
Some (but not all) of the answers:
1) SD card: Yes you can add an SD card. The easiest way is to get an SD card socket on a holder from somewhere like sparkFun.com. The connections are:
P1_21 -> CS / CD / DAT3
P1_24 -> DI / CMD / MISO
P1_23 -> DO / DAT0 / MISO
P1_20 -> CLK
GND -> GND
3.3V -> Vcc
The SD card pins have several different names depending on the exact holder you get, I think the list above has covered all the normal ones.
The code is then:
SDFileSystem sdCard(D11, D12, D13, D10, "sd"); // all file names starting with /sd/ will be on the SD card. FILE *outputFile = NULL; main () { outputFile = fopen ("/sd/MyFile.txt", "w"); // use wb in place of w if logging binary rather than text if (!outputFile) error("ERROR: couldn't open log file\n"); fprintf(outputFile,"Log data and stuff\n"); fclose(outputFile); // If you miss this out then you'll get an empty 0 byte file. }
One issue I have found with the C027 - Unlike the LPC1768 which can supply a lot of power the 3.3V output on the C027 can't output much power, it's intended for use as a reference rather than to power things. Putting a 10uF capacitor directly between the Vcc and GND pins on the SD card socket helps (and 0805 surface mount part fits well) but you need to be careful on the card you use. My system is rock solid with a slower 2GB SD card but still fails every time with a faster 4GB card. Obviously if you add your own 3.3V supply for the SD card then all the problems go away.
One further trick I tend to use, on a timer or some sort of file size counter close the current file and open a new one. That way if you pull the SD card out or turn the power off you only lose the data in the current file and not everything. You can use sprintf to generate a file name with a counter in it e.g.
Ticker fileUpdateTick; FILE *outputFile = NULL; void onFileCloseTicker() { static unsigned int fileNumber = 0; char[25] fileName; if (outputFile) fclose(outputFile); sprintf(fileName,"/sd/Log%04d.txt",fileNumber++); outputFile = fopen(fileName, "w"); if (!outputFile) error("ERROR: couldn't open log file %s\n",fileName); } main { onFileCloseTicker(); // create the first log file; fileUpdateTick.attach(onFileCloseTicker(),60*5); // auto update file name every 5 minutes. }
2) CAN interface The can interface has screw attachments for connecting wires. If you get a cable from your car to bare wires then it will be easy to connect.
3) No idea.
4) Any warranty is going to be meaningless as soon as you start soldering wires up to it. You put the wrong voltage on the wrong pin and things blow up.
5) I believe so but haven't verified it.
6) No reason why not, this would however add software complexity so it depends on how secure you need the encryption to be. You could in theory use USB or ethernet but the simplest way would probably be to connect them via a serial port. If you were to offload to a Raspberry Pi or similar then it would make more sense to use that to log the data since it already has an SD card attached.
Thanks Andy. We go for this card :).
To avoid SD card complexity and off load encrpytion, I will use Beagle Bone Black (http://beagleboard.org/Products/BeagleBone%20Black)
Can you please provide some information about how can I connect to Beagle Bone?
posted by 21 May 2014