Accelerometer DataLogger

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Accelerometer DataLogger

Post by JohnCrow »

Accelerometer DataLogger

This is my first project using the “001-Tech” Accelerometer Board. It is fully compatible with the accelerometer module in Flowcode 5.
It is designed to show the principles of operation and test the unit.

The sensor used is the the LIS3LV02DQ 3 axis accelerometer. This device has a full scale of either 2g or 6g.
This project utilises the 2g setting.

It is supplied on a small “postage stamp size” pcb along with a couple of other components and an 8 pin SIL header.

The board operates of a 3.3V supply, so cannot be connected to PIC without voltage conditioning.
The interface is either I2C or SPI

I have chosen to use a TO92 style 3.3V 3-pin regulator.
Due to the low power drain of the board it can be powered from a pin on the microcontroller.
This allows it to be connected without a separate power wire as is normal for most e-blocks

Hardware:

As most of my projects uses the EB006 programmer board I have had a change with this one and used my ECIO40 System

EB061 ECIO40 Application Board
ECIO40 Micro-Controller Device
EB016 Prototype Board (Port B)
Custom 4 Line 20 Character LCD Display (Port D)
EB634B 500mm Ribbon Cable – To connect the accelerometer and allow freedom of movement.
EB037 SD Card Reader (Port A)
EB007 Switch Board (Port C)

3.3V 3-pin Voltage Regulator
Jumper Wires To Suite

Connections:

The Accelerometer is connected as follows

VDD 3.3V Regulator Output
GND 0V
RDY Port B Pin 0 (Data Ready)
SDO No Connection
SDA Port B Pin 1 (Data Out)
SCL Port B Pin 2 (Clock)
CS 3.3V
VDDIO 3.3V


Port A Pin 0 Data Available
Port A Pin 1 SDA
Port A Pin 2 SCL
Port A Pin 3 Power to 3pin regulator


The current drawn by the accelerometer is small enough to allow it to draw power from the PIC itself.
NOTE it must not be connected to 5V.
Either a 3pin regulator, zener diode or a pair of equal value resistors as a voltage divider, (the accelerometer can run at 2.5 V) must be used.

Operation:

Reading Raw Data:

The program is used to sample the outputs of all 3 axis of the accelerometer over a short period of time.
They are displayed on the lcd along with a counter showing how many samples have been taken.
All 3 data points are saved to an SD card as a data string using CSV file format.
This means the data can be read back and plotted as a graph using Microsoft Excel.

For simplicity a sample of about 100 sets of reading will be taken.

The manufacturer’s data sheet shows the outputs are nominally ±1024 at full scale, when running at 3.3V.

Press the reset button on the ECIO.

After the system has booted it will request a card be inserted.

Insert a suitable memory card, the system will check if it’s clear, if not the card will be wiped first and the data file created.

Move the accelerometer about in all 3 planes, take care not to bang or jar the device as this can cause damage.

Once enough data has been acquired, press switch 0 on the switch board to stop logging. Just removing the card can cause data loss.

The system will show a remove card message.
After a couple of seconds the system will restart and wait for a new card to continue logging.

The memory card was then read in the PC and a graph plotted of the first 50 data points.
(50 was chosen as its shows the principles without being overly cluttered.)


The actual full scale raw data will according to the data sheet, vary depending on both the actual sensor and the supply voltage. The full scale must be determined experimentally.
Accelerometer_DataLogger-2G V1.fcf
(32.61 KiB) Downloaded 415 times
Graph.jpg
Graph.jpg (93.46 KiB) Viewed 6652 times
The attachment Accelerometer_DataLogger-2G V1.fcf is no longer available
Attachments
Test System
Test System
Accelerometer-System.JPG (99.24 KiB) Viewed 6657 times
1 in 10 people understand binary, the other one doesn't !

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Accelerometer DataLogger

Post by Benj »

Cheers John,

Great article.

Just noticed this. "The attachment Accelerometer_DataLogger-2G V1.fcf is no longer available" though the file does seem to be available a bit higher up :D

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Accelerometer DataLogger

Post by JohnCrow »

Yes Id originally uploaded the FC file twice by mistake, and deleted one instance, but it still left that on the post.

The long ribbon cable is great for testing things like this :)
1 in 10 people understand binary, the other one doesn't !

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: Accelerometer DataLogger

Post by Sparkoids »

I've got one of those 001-Tech boards and will look at this later - thanks John... (again!)


James :-}

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Accelerometer DataLogger

Post by JohnCrow »

They are a nice little board
1 in 10 people understand binary, the other one doesn't !

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Re: Accelerometer DataLogger

Post by Mark »

John,

Thanks, I pinched your SD_Card setup macro as I could not get my card working on an EB037.

Works fine now - a platform to make my own routine.

Regards,

Mark
Go with the Flow.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Accelerometer DataLogger

Post by JohnCrow »

Hi Mark
That's fine. Glad you got it to work.
1 in 10 people understand binary, the other one doesn't !

Post Reply