Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water. Oh… Well I decided to leave that thread for later because I wanted to focus on getting something recorded on the SD card. I see now the mistakes I did. I would change to SdFat if it makes things better, I was trying to get something to work first. The code is now working for me. Thank you very much! The Filename issue was the only thing that I did not knew.
Yes, I am using Mayfly. I am using the built-in microSD card slot. My output I get the values in the serial monitor but nothings gets written into the SD card. The last question is kind of confusing to me, but what I am thinking is that you are asking me if I ever put the code of the SD card somewhere else in this code then yeah, but I still get nothing written into the card.
I removed Sdfat from it and it did not work either. Should I try with sdFat library only?
I am trying to get a txt file of the data from all four sensors to the SD card. It works when I use the first code for the DHT sensor only, the data is recorded inside the SD card as a txt file and I can open it when I connect the SD card into my laptop to see the contents of it. I use this
to record all the data from the four sensors which is the second code I uploaded here and it does not work. A txt file is not created, and no data is collected. The code itself works. I can replace the “sensorsdata” with “Serial” instead, and it does display the data of the sensors in the monitor. But the code to make the txt file and place all the data of the four sensors in the SD card does not work.
Alright. I am getting the data right. Thank you for your help.
Also, with the code you provided, if I do not use the voltage divider I can calibrate it to 2.5V if I remove the *2 from the equation. I am first time coder and also the mayfly is something new for me as well, I am learning little by little how this thing works. So the calibration will be right if I use the code without multiplying the 2?
Sorry for the late answer I had some stuff to do.
Okay so, the circuit is connected like this:
Voltage: V+ which is the 5V DC connected to SW5
Ground: Ground to Ground
Analog = PO or PH analog output is connected to the Analog pin A0
I used three resistors to test which one will be close to the voltage required, I will post a picture of the three of them.
The voltage output I get from your code displays more than 5V, I can’t calibrate it to 2.5V that way.
The circuit is guarantee is properly connected.
Also you have been helping me out a lot, I appreciate it.
The pin is USB5V, I tried using that SW5 as well. I tried using all those slots, all of them gave me the exact same value of 3.73V.
pin A0,
here is the code:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over showing the voltage on A0
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 – 1023) to a voltage (0 – 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage);
delay(300);
}
We use cookies to improve your experience on our site. By using our site, you consent to cookies.
Websites store cookies to enhance functionality and personalize your experience. You can manage your preferences, but blocking some cookies may impact site performance and services
Essential cookies enable basic functions and are necessary for the proper function of the website.
CleanTalk offers effective spam protection and website security solutions to enhance user experience.
Service URL: cleantalk.org (opens in a new window)
CloudFlare provides web performance and security solutions, enhancing site speed and protecting against threats.
Service URL: developers.cloudflare.com (opens in a new window)
These cookies are needed for adding comments on this website.
These cookies are used for managing login functionality on this website.
WooCommerce is a customizable eCommerce platform for building online stores using WordPress.
Statistics cookies collect information anonymously. This information helps us understand how visitors use our website.
Google Analytics is a powerful tool that tracks and analyzes website traffic for informed marketing decisions.
Service URL: policies.google.com (opens in a new window)
SourceBuster is used by WooCommerce for order attribution based on user source.
You can find more information in our Cookie Policy and Privacy Policy.