I would like to begin by saying that I am a beginner when it comes to electronics. The issue I am facing is when I am using an Arduino Pro Mini in conjunction with an ADXL377 accelerometer, SD card reader, and a real time clock, the Z axis of my accelerometer is reading 200g at rest while the other axes read normal values. I used a multimeter and found that there is continuity between the VCC, Z, and A0 pins on the board (the A0 pin is connected with solder to the Z pin on the breakout board). From what I can tell, there is no point where the VCC is wired to the A0 pin. I have tried to clean up the solder but I would rather get a second opinion before I mess up the board even further. Attached are pictures of the top and bottom of the thru hole board where I have soldered/wired all the components together. I have already gone through the troubleshooting videos on Sparkfun’s website and some of the links led me to the multimeter suggestion. I am hoping that y’all can point me in the right direction and hopefully I can salvage this board.
Here is my code if it helps:
#include <SPI.h>
#include <SD.h>
#include <RTClib.h>
RTC_PCF8523 rtc;
File myFile;
const int dataWrite = 5; //Number of readings before the sd card writes to file
//const int delaytime = 5; // Time between readings, counted as milliseconds
float scaledReadings [3][dataWrite]; //Storage for the data collected by the accelerometer
const int button = 3; // pushbutton pin
int buttonState; // for reading the pushbutton state
int state = 0; //For deciding if the system is starting or going into another loop
void setup() {
// Initialize serial communication at 115200 baud
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect.
}
// Initialized the pushbutton as input
pinMode(button, INPUT_PULLUP);
//initialize Real Time Clock (RTC)
if (! rtc.begin()) {
Serial.println(“Couldn’t find RTC”);
Serial.flush();
abort();
}
if (! rtc.initialized() || rtc.lostPower()) {
Serial.println(“RTC is NOT initialized, let’s set the time!”);
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(DATE), F(TIME)));
}
// see if the card is present
if (!SD.begin(10)) {
Serial.println(“Card init. failed!”);
}
Serial.println(“Starting data collection.”);
}
void loop()
{
buttonState = digitalRead(button);
if(buttonState == 0 && state == 0){
//Create a file name for the data to be stored
char filename[15];
strcpy(filename, “DATA00.CSV”);
for (uint8_t i = 0; i < 100; i++) {
filename[4] = ‘0’ + i / 10;
filename[5] = ‘0’ + i % 10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(filename)) {
break;
}
}
myFile = SD.open(filename, FILE_WRITE);
if ( ! myFile ) {
Serial.print("Couldnt create ");
Serial.println(filename);
}
//get the last filename
strcpy(filename, “DATA00.CSV”);
for (uint8_t i = 0; i < 100; i++) {
filename[4] = ‘0’ + i / 10;
filename[5] = ‘0’ + i % 10;
if (!SD.exists(filename)) {
filename[4] = ‘0’ + (i - 1) / 10;
filename[5] = ‘0’ + (i - 1) % 10;
break;
}
}
//Initialize SD card and make sure it has opened correctly
Serial.println(“Initializing SD card…”);
if (!SD.begin(10)) {
Serial.println(“initialization failed!”);
return;
}
Serial.println(“successful!”);
myFile = SD.open(filename, FILE_WRITE);
delay(1000);
}
if (myFile) {
Serial.println(“Your file has opened, beginning to record data.”);
//Take readings from the accelerometer
if (buttonState == 0) {
do {
readWrite();
buttonState = digitalRead(button);
} while (buttonState == 0);
state = 1;
}
if (buttonState == 1 && state == 1){
myFile.close();
Serial.println(“Data Saved”);
state = 0;
}
}
else {
Serial.println(“Waiting for system to be turned on”);
}
}
void readWrite() {
for (int b = 0; b < dataWrite; ++b)
{
int rawX = analogRead(A2);
int rawY = analogRead(A1);
int rawZ = analogRead(A0);
scaledReadings[0] = mapf(rawX, 0, 1023, -200, 200);
scaledReadings[1] = mapf(rawY, 0, 1023, -200, 200);
scaledReadings[2] = mapf(rawZ, 0, 1023, -200, 200);
//For debugging of the sensor readings
Serial.print(scaledReadings[0]); Serial.print(“,”); //x axis reading
Serial.print(scaledReadings[1]); Serial.print(“,”); //y axis reading
Serial.println(scaledReadings[2]); //z axis reading
//delay(delaytime);
}
for (int a = 0; a < dataWrite; a++) {
DateTime now = rtc.now();
myFile.print(now.hour(), DEC); myFile.print(‘:’);
myFile.print(now.minute(), DEC); myFile.print(‘:’);
myFile.print(now.second(), DEC); myFile.print(“,”); //time in seconds
myFile.print(scaledReadings[0][a]); myFile.print(“,”); //x axis reading
myFile.print(scaledReadings[1][a]); myFile.print(“,”); //y axis reading
myFile.println(scaledReadings[2][a]); //z axis reading
}
}
// Same functionality as Arduino’s standard map function, except using floats
float mapf(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}