Hello,
For start I want to describe what I want to build for what purpose.
I need to build an inclinometer which can record data somehow, and have a visual feedback (aka display :D). It would measure an angle of some moving plate. Form factor should be small (Uno or Mini) the Mega is too big. The data what I want to record is runtime (0-10s most of the time), the angular acceleration, speed, and the angle. The sampling will be 10 Hz. There is no place for cables so I need to store the data locally. I would use an SD card for this. On the top of the tool I want to put a display what shows the actual value of XYZ (see specific type below). It would be great if it can be reseted/recalibrated for the starting position. I mean the moving plate starting position is 3° according to gravity but I can use it as a zero reference.
Parts I planning to use:
1 x Arduino UNO
1 x GY521 / MPU6050 (6DOF) accelerometer
1 x MicroSD modul (Standard SPI)
1 x 0.96in 128x64 OLED display, I2C (4 pin)
Now I think I can start describe my problem. I bought these parts and I start testing them one by one, to check what they do etc. I downloaded the libraries and sample codes for each. They works separately. Then I started to put things together and the problem is occured fast When I use the SD card modul and display the memory disappers. I not connected the gyro module, but I put it in the code to see can I flash it or not. (As turns out I can't :D)
Here is the code which is not fit into the 32 Kbyte memory.
//-----------------------------------------------------------------------
//oLED libs
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
//SD libs
#include <SD.h>
#include <SPI.h>
//gyro libs
#include <MPU6050.h>
//----------------------------------------------------------------------
//for oLED
#define OLED_ADDR 0x3C // OLED display TWI address
Adafruit_SSD1306 display(-1); // -1 = no reset pin // reset pin not used on 4-pin OLED module
#if (SSD1306_LCDHEIGHT != 64) // 128 x 64 pixel display
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
//for SD
File myFile;
int pinCS = 10;
//for gyro
unsigned long timer = 0;
unsigned long timer2 = 0;
float timeStep = 0.01;
float pitch = 0;
float roll = 0;
float yaw = 0;
//-----------------------------------------------------------------------
void setup() {
Serial.begin(9600);
pinMode(pinCS, OUTPUT);
//oLED init-------------------------------------------------------------
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
display.display();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("Display OK...");
//SD card init----------------------------------------------------------
if (SD.begin())
{
Serial.println("SD card is ready to use.");
} else
{
Serial.println("SD card initialization failed");
return;
}
display.setCursor(10,0);
display.print("SD Card OK...");
//-----------------------------------------------------------------------
void loop() {
//The cake is a lie!
}
What should I do?
I did not even start to write the actual datalogger code. I think the libraries takes that much place from the memory.
Is it possible or not that using the 3 module on one Arduino?
I think over the project and got an idea to use Bluetooth module and a gyro on one UNO board, put it on the measurable moving plate. While I create an other device with Bluetooth & display & SD logger module. Then this device can be the larger Mega. Can the HC-05 bluetooth modul transfer the 10Hz data fast enough? Not least this alternative build is more expensive.
Thank you for your help!
If you have any more question I gladly answer it.