Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

Need some help with the Data Logger Shield
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Need some help with the Data Logger Shield

by tsans99 on Fri Nov 19, 2021 12:12 pm

I assembled a wind speed sensor using Adafruit’s Anemometer Wind Speed Sensor w/Analog Voltage Output, an Arduino Uno and a 16x2 LCD display and it works just fine. I decided to log the data and added Adafruit’s Data logger and now I have problems. The LCD display works but the A0 input used for data input just reads a constant value no matter what the wind speed is. Remove the Data Logger and everything is fine. I checked the wiring and solder connections and don’t see any problems.

Any suggestions on how to proceed?

Tom,

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by adafruit_support_bill on Fri Nov 19, 2021 4:23 pm

What is the constant value that it reads?

Please post some clear photos showing your soldering and connections.

adafruit_support_bill
 
Posts: 82851
Joined: Sat Feb 07, 2009 10:11 am

Re: Need some help with the Data Logger Shield

by tsans99 on Sat Nov 20, 2021 11:12 am

20211119_125457 (002).jpg
20211119_125457 (002).jpg (822.02 KiB) Viewed 726 times
Serial Print.jpg
Serial Print.jpg (124.5 KiB) Viewed 726 times
Thanks for the reply.

Attached are 2 images. The first is a screen shot of the Serial Monitor displaying the input value of A0. It settles down to about 339 in an hour or so. The second is an image of the solder joints on the shield. It looks a bit messy after I had to move the wires out of the way to get a clear image. The 2 solder "blobs" are Gnd and +5V.

Any help would be appreciated.

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by adafruit_support_bill on Sat Nov 20, 2021 11:19 pm

I see a lot of wires, but the photo does not show where they all go, Please post photos showing all your connections. Also please post the code you are using.

adafruit_support_bill
 
Posts: 82851
Joined: Sat Feb 07, 2009 10:11 am

Re: Need some help with the Data Logger Shield

by tsans99 on Mon Nov 29, 2021 12:07 pm

[code][/code]
Pic 3 All 3 Modules Connected.jpg
Pic 3 All 3 Modules Connected.jpg (403.58 KiB) Viewed 518 times
Pic 2 Data Logger Attached.jpg
Pic 2 Data Logger Attached.jpg (670.05 KiB) Viewed 518 times
Pic 1 Breadboard wiring.jpg
Pic 1 Breadboard wiring.jpg (653.81 KiB) Viewed 518 times
Pic 3 All 3 Modules Connected.jpg
Pic 3 All 3 Modules Connected.jpg (403.58 KiB) Viewed 518 times
It took a while but I decided to take a different approach to this project. I did the wiring on an Arduino Uno breadboard and order a new Adafruit Data Logger to see if that might be the problem, it wasn’t.

Pic 1 shows the wiring on the breadboard as shown in the Fritzing file attached. Pic 2 shows the Data Logger attached and pic 3 is just a side view of the 3 boards attached,
The Sketch “Test_wo_Logger_Code” is a simple one to take the inputs of the anemometer and display the results on an LCD. It works as expected with and without the Data Logger attached. The Sketch “Test_with_Logger_Code” is the same Sketch but with a few lines added to see if the SD card could be initialized and written to. The test works just fine with only the Data Logger attached to the Arduino but fails to initialize when all 3 components are connected.

My conclusion is that the Arduino and Data Logger communicate as expected and nothing is wrong with either so there must be something in my design or construction of the breadboard circuit that is causing the problem.

Any ideas? Any help would be appreciated.

Tom

/*
Test wo Logger Code
*/

//Initialise LCD display

#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 6, 9, 11, 12, 13);

//Setup Variables

const int sensorPin = A1; //Defines the pin that the anemometer output is connected
float sensorInput; // Raw data fron sensor input
float sensorvalue;
int numbercount = 10; //Number of inputs to average
float inputsum = 0; //sum of inputs during count cycle
float avginput =0; // average input value for (numbercount) inputs
int mapval = 0; //Value of avginput mapped to 0 to 72
int delaysec = 10000; // Time for delay in updating reading

int chipSelect = 10; // chipselect pin for the SD card reader

void setup()
{

//Setup LCD display with welcome screen

lcd.begin(16, 2);
lcd.print("TAS 11-28-21");
lcd.setCursor(0, 1);
lcd.print("Windspeed Sensor");
lcd.setCursor(0, 0);
Serial.begin(9600); //Start the serial connection

}

void loop()
{
sensorInput = analogRead(sensorPin); //Get a value between 0 and 1023 from the analog pin connected to the anemometer
sensorvalue = sensorInput;
inputsum=0;

for (int i = 1; i <= numbercount; i++) //Count number of cycles taken for average
{

inputsum = inputsum + sensorvalue; //Accumulate readings for average

}

avginput=inputsum/numbercount; // compute average input value for (numbercount) inputs

Serial.print("avginput: ");
Serial.println(avginput);
mapval=avginput;
mapval = map(mapval,87,1023, 0,72); // mmap averag value to wind speed
if(mapval <0) { mapval=0;}
Serial.print("mapval: ");
Serial.println(mapval);

lcd.setCursor(0, 0);
lcd.print("Wind MPH = ");
lcd.print( mapval);

delay (delaysec); // Delay so reading updates every x seconds

}
====================================================================
/*
Test with Logger Code
*/

//Initialise LCD display

#include <LiquidCrystal.h>
#include <SPI.h> // Include SPI library (needed for the SD card)
#include <SD.h> // Include SD library
LiquidCrystal lcd(4, 6, 9, 11, 12, 13);

//Setup Variables

const int sensorPin = A1; //Defines the pin that the anemometer output is connected
float sensorInput; // Raw data fron sensor input
float sensorvalue;
int numbercount = 10; //Number of inputs to average
float inputsum = 0; //sum of inputs during count cycle
float avginput =0; // average input value for (numbercount) inputs
int mapval = 0; //Value of avginput mapped to 0 to 72
int delaysec = 10000; // Time for delay in updating reading

int chipSelect = 10; // chipselect pin for the SD card reader

void setup()
{

//Setup LCD display with welcome screen

lcd.begin(16, 2);
lcd.print("TAS 11-28-21");
lcd.setCursor(0, 1);
lcd.print("Windspeed Sensor");
lcd.setCursor(0, 0);
Serial.begin(9600); //Start the serial connection

while (!Serial) {; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");

if (!SD.begin()) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
}

void loop()
{
sensorInput = analogRead(sensorPin); //Get a value between 0 and 1023 from the analog pin connected to the anemometer
sensorvalue = sensorInput;
inputsum=0;

for (int i = 1; i <= numbercount; i++) //Count number of cycles taken for average
{

inputsum = inputsum + sensorvalue; //Accumulate readings for average

}

avginput=inputsum/numbercount; // compute average input value for (numbercount) inputs

Serial.print("avginput: ");
Serial.println(avginput);
mapval=avginput;
mapval = map(mapval,87,1023, 0,72); // mmap averag value to wind speed
if(mapval <0) { mapval=0;}
Serial.print("mapval: ");
Serial.println(mapval);

lcd.setCursor(0, 0);
lcd.print("Wind MPH = ");
lcd.print( mapval);

delay (delaysec); // Delay so reading updates every x seconds

}

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by tsans99 on Mon Nov 29, 2021 12:14 pm

TAS Design_bb.jpg
TAS Design_bb.jpg (406.32 KiB) Viewed 516 times
Sorry, I forgot to add the Fritzing image.

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by adafruit_support_bill on Mon Nov 29, 2021 12:36 pm

the issue is here:
Code: Select all | TOGGLE FULL SIZE
LiquidCrystal lcd(4, 6, 9, 11, 12, 13);

On an Arduino UNO, pins 11, 12 and 13 are part of the SPI bus - which is used to communicate with the SD card.

It looks like you have a few free pins in your Fritzing diagram. So you should be able to re-configure the LCD to avoid the SPI bus.

adafruit_support_bill
 
Posts: 82851
Joined: Sat Feb 07, 2009 10:11 am

Re: Need some help with the Data Logger Shield

by tsans99 on Mon Nov 29, 2021 3:57 pm

TAS Design_bb.jpg
TAS Design_bb.jpg (437.76 KiB) Viewed 507 times
Thanks for the quick reply, I appreciate it.

I reconfigured as shown in the attached Fritzing but I still get the "Failed to initialize" message. I don't know enough about the code for the Data Logger so is what I have coded correct? Any other suggestions?

Also, where do I get information about the pins on the Data Logger. All I've ever seen referenced is Pin 10.

Thanks,

Tom

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by adafruit_support_bill on Mon Nov 29, 2021 4:21 pm

Did you change your code to match the new wiring configuration?

adafruit_support_bill
 
Posts: 82851
Joined: Sat Feb 07, 2009 10:11 am

Re: Need some help with the Data Logger Shield

by tsans99 on Mon Nov 29, 2021 5:33 pm

Yes, I changed the code to match the new wiring.

BUT!!!! I think I got it.

As I said, a little knowledge to get me into trouble. I noticed the 6 pins on the edge were labeled SPI so I added some connectors to get the Arduino in contact with the Data Logger and guess what, it works and that program now initializes the SD card. I've yet to write to the SD but I'm hopeful.

Thanks again,

Tom

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by adafruit_support_bill on Mon Nov 29, 2021 5:43 pm

If you install the 6-pin ICSP header packed with the kit, those SPI connections should be automatic for all but the oldest models of Arduino.

adafruit_support_bill
 
Posts: 82851
Joined: Sat Feb 07, 2009 10:11 am

Re: Need some help with the Data Logger Shield

by tsans99 on Tue Nov 30, 2021 11:17 am

I didn't install them because I wanted headers that would allow me to "thru-connect" the Data Logger through the breadboard to the Arduino. I've corrected that and now things work fine. My next problem, learning how to use the RTC clock.

Thanks,

Tom

tsans99
 
Posts: 12
Joined: Thu Nov 18, 2021 4:17 pm

Re: Need some help with the Data Logger Shield

by rpiloverbd on Fri Dec 03, 2021 3:56 pm

What if you change your input pin? Suppose, if you chose A1 or A5 instead of A0, does the problem persist?

rpiloverbd
 
Posts: 92
Joined: Mon Nov 29, 2021 8:13 am

Please be positive and constructive with your questions and comments.