LESSON 21: Data Logging from Arduino to SD card
Вставка
- Опубліковано 6 лют 2025
- This video shows step-by-step instructions on logging sensor data from an Arduino to an SD card. This facilitates easy importing into Excel and easy charting, graphing and data analysis. We use the BMP180 pressure sensor and a standard SD card reader. For more details see Arduino LESSON 21 at www.toptechboy.com.
Give this man a medal, He is actually teaching, not just posting links for the codes and pictures with the pinouts. while playing a weird background music
He deserves more than a medal . Such a selfless Human , never seen in recent past...
he's a mith
@@caiomolinari4790 no doubt
@@caiomolinari4790 An Enigma
Hey Paul if you still look at these comments i just wanted to say that these lessons helped me so much. THANKS!!
First of all just like to say a massive thanks , I've been struggling for years trying to learn basic electronics and programming and your lessons have opened up a whole new world of learning.
This particular lesson was a bit challenging but so rewarding, I had to jump through a few hoops such as buying a different SD logger and the kit I had a temperature and humidity sensor with only three pins !
Such a fantastic feeling getting it to work, thank you Paul.
Paul is right on the money. Simple , straight forward , and best of all the code actually works. Good Job.
Waiting patiently for my sensor to arrive so i can implement this project. My 14 year old step daughter likes your videos because she says she likes chilled out teachers like you.
It is good to hear a young lady is interested in Engineering. We need more women in this profession.
I had never seen that kind of TUTOR on the youtube. Just Amazing.
Mind Blowing. I Can't even imagine the possibilities and things I can do learning this lesson.
With the help of this extraordinary well explained tutorial of yours, I was able to get my triple axis accelerometer data onto a micro SD card and onto MS Excel. Thank you for helping and showing us to learn engineering skills!
Many thanks Paul, I had built a project using the Micro SD manufacturer recommendations and an ARDUINO UNO (Elegoo). The SD card vendor diagram tells you to use PIN10 as CS, but the SD card crashed after recording some data and had to be formatted. Windows could not even detect the card and had to be formatted with the SD format software, but after a few SD reformats it was damaged beyond repair... and of course data lost.
I followed your advice and used PIN 9 as CS and left PIN10 free , and this has worked and I am recording data every 2 seconds to test the SD card.
I will start reading the libraries to understand this type of requirements better
Again, a beautiful tutorial and extremely helpful for those of us learning this beautiful technology. God Bless You.
I just wanted to tell you Paul, these helped me gain recognition at my job. You taught us so well.
Hey Mr.Paul
You are the best teacher I've ever seen. I am sure that your students love your classes and They are LUCKY to have you as their teacher.
please keep those lessons coming and let us (people who have no access to learning resources ) learn something new day by day and pass it to others so that the entire PLANET EARTH is happy :)
Dear Paul
you are a great tutor! I am intensively watching your videos during the last months! Thumbs up for Space Cowboys too!
Thank you very much, Mr. McWhorter. I'm preparing for the CanSat competition. Videos like this help me a lot.
Wow ... what a guy! You are a rare gem. Thank you so much for the help and tutorials you provide.
You teach in such an informative and effective way. :)
I'm writing this just in case it can help somebody else who may have had a similar experience.
All these lessons have been stellar. I followed this one to exact detail, and everything worked on the Ardiuno side (serial monitor was rolling through temp and press readings just as expected), but every time after ejecting the SD card and plugging it into the computer, it was full of corrupt and fragmented files. My card reader looks exactly the same (no mfgr name printed anywhere) as Paul's, and came dirt cheap from amazon. But it kept writing corrupt files.
What finally got it working was moving the connection wire on the SD card from 5V to 3.3V, and then plugging the other end directly into the 3.3V pin on the arduino, instead of into the 5V rail on the prototype board. In other words, the arduino has one wire from its 5V pin to the prototyping board, and another wire from its 3.3V pin straight to the 3.3v pin on the sd card reader.
I tried this because several other SD card readers on the market only have a 3.3v input. This lead me to believe 5V is too much for an SD card. I don't really know enough about electronics to know for sure. It was just a pattern I noticed. I think in my case I got a faulty SD reader. Maybe it's supposed to step down any 5V inputs to the 3.3V an sd card needs, but mine wasn't doing that correctly. So, a direct use of 3.3 made things work. Again, no idea why, as I don't have an electronics background, but it worked.
I was trying to mash code together to get my datalogger to work, unsuccessfully, until I found your videos. From one of your comments in a video I realized my error. This time I learned from the ground up with your sensor video and this one. I now completely understand the code I'm using and look forward to trying to add RTC data to this sketch. Thank you so much!
Thank you so much Mr. Mcwhorter, my code was very different because I used an LCD instead of serial and added some print statements incase no sd card was found and it runs exactly the same as yours. I really can code arduino (not all of course) by myself now and it's because of your lessons. This is invaluable to me, seriously from the bottom of my heart thank you so much! Sadly I don't have a gps module yet but when I get one I'll continue with the course but I'm going to browse your other Arduino related stuff. Thank you again I'd give you a hug if I wasn't hundreds of miles away. Best teacher I've ever had...
You are simply amazing sir, wasted 3 hrs of my valuable time by not checking on your website if u have a tutorial for Sd card. Looked around on Google. Some hits some miss. But now I am clear on the logic the way this module works. Thanks a lot
OMG - Your amazing... I am new to micro controllers and was a little stuck as to what to do and how to do it. I have watched your videos and have learnt so much. Your amazing and most of the questions I have had whilst watching your videos have been answered by the end. Keep up the great work.
Many thanks for this wonderful lesson and explanation of this powerful tool. I started learning Arduino with the very goal in mind to log data. God bless you from South Africa
Hello Paul, You have vary good Arduino training video series, nicely done :)
I was working Lesson 21:
Anyways the SD file system limitation is a legacy DOS 8.3 file format convention / limitation meaning up to 8 characters for file name and up to 3 characters for file extension XXXXXXXX.XXX .
Also your SD data logging example, if you use .csv comma-separated values (CSV) vs (TXT) file extension it will automaticly associate and import into Excel without manually determining the deliminator fields every time.
You are vary good teacher and your students are vary lucky to have you :)
Thanks MIke DeLosier.
It is good to see your lessons . Thank u so much sir
One more time !!! surprise me with this good tutorial !!!!!! "" God bless you paul "" "!!
Greetings from Colombia!
Thanks Paul - I am continuing to learn from your lectures .
great tutorial. very well explain every single tutorial from this gentleman .
after checking youTube and other Udemy and other tutorials this still one of the best teacher .thank you for introduce programming to the people.
Amazing!
Being able to data log then convert to a graph has many uses , you could possibly use a load cell , temp sensor , hall effect sensor etc to make a small engine dynamometer and much more !
Your videos just keep getting better and better!
I'm starting to kick myself for not getting into PIC when it first hit the ground and now even more so because i ignored Arduino for so long .
Thanks Paul, not too late for a compliment on your tutorials, they are fantastic, I ping & echo the same sentiment as others here, finally projects that have utility.....lol
Sir Paul McWhorter, you are a motivation for me to take interest in programming. although I hate programming when I saw your lectures I came to know that programming is a bit kind of a game.
Great video. I like how you explain and add comments to each line.
Another great lesson. Time to get my big mug of iced coffee and get into it!
@13:13 : The Arduino SD library only supports the DOS 8.3 filenames (i.e. up to 8 char for the file name and 3 for the extension).
Great lesson! I love your enthusiasm. Thank you!
Dear Mr.McWhorter thank you so much for your videos! keep up the great work !!!
best teacher on youtube
Thank you Paul for all these videos.
Awesome stuff - thanks! I ordered the same card reader & pressure sensor just now and can't wait to get em in a couple days so I can do this exercise.
Also, thanks for pointing to your Python+Arduino lessons cuz I almost forgot you had those and so will check those out too while waiting for my parts.
I looked ahead at the rest of your lessons for any more parts I might need for those and ordered the GPS tracker today too. Thanks again - keep up the good work - have fun - peace.
Great video! I seemed to have found you on lesson 21 however I am certainly going to go back and start with lesson 1. By far the best Arduino videos I have found so far. Thank you very much for making these videos. A thumbs-up for sure! How could anyone possibly give these videos any other rating. My initial batch of Arduino 'stuff' arrives in a day or two and I can't wait to use your videos as a major reference.
Patriot Prepper Thanks for the encouraging words. Glad you found the videos useful. Thanks!
Absolutely amazing and very comprehensive.
pleasure
Watch your videos on UA-cam
I learned a lot from you
Your explanation is pleasant to hear. Because you are an excellent teacher.
Please continue to teach humanity
Many thanks
Thank you for the kind words!
Very Nice Video Paul! I just subscribed. FYI, MOSI = Master OUT, Slave IN, MISO = Master IN, Slave OUT. Of course, Arduino is the Master in this case.
Fun and very telling - Thank you Paul !!!
Hello Paul
This was a perfect lesson
Thank you for yours time.
Excellent Lesson!
Is there a way to specify the time interval e.g. every minute, every hour etc? Thanks.
Interesting project. I have watched your previous lessons too. Nice and lucid explanation. Thank you sir. :)
Great and Very Very Thank you for this.
If it is possible can you please cover the RTC Real Time clock module in your lesson?
love your explanation... details works are always the best
#21 is a great tutorial!!! My next step is to time stamp the data by reading time and adding it as column 1 in the Excel data. I have an RTC shield on my Arduino Uno R3. Do you have a tutorial on time-stamping? Thank you for your wonderful easy-to-follow lessons
Thank you so much sir... Can we use the same logic for data logging from modbus sensors.
Hi Paul. Thoroughly enjoying your course! However, I am sure that you know that Virtuabotox gear is not available in Amazon. It might be helpful to update the videos pr information accompanying them with appropriate alternatives... Kind regards
Takk!
Thanks, really appreciate that!
Really clear and useful! Thank you for sharing!
Amazing video, what type of SD card did you use? I keep getting the "SD card initialization failed."
Great tut, thank you Paul!
hello ...sir
ur teaching method is amazing....
could u please make a tutorial with RF modules ....
i have searched ...online...but i could not understand....so....
on the SD card reader, does the AMS1117 on the shield in addition to voltage regulation, act as a current limiter?
8:55 I appreciate you trying to explain the File object to us, but I would have liked it better, if you had gone a little more into detail about how it actually works? Thanks;)
Paul, I am having difficulty in getting the SD card reader to initialize using the basic Arduino IDE supplied, "CardInfo" program. According to the documentation you posted about the reader itself, it indicates that it needs both 3.3VDC and 5VDC as I believe I see no level shifters present on the board. Yet, somehow in your video, you did not connect 3.3VDC and yet your project worked? I am confused at this point because I have virtually the identical hardware for the SD reader and yet I am having a major challenge just getting it to be read....any thoughts would be much appreciated :-)
sir,why are we using a reserve pin????? where should it be connected??? give more details about it
I want to make a pixel stick ( led light painting tool ) with image processing. I have never even seen an arduino uno so would it be possible for someone with my experience to have a go using your channel ? I think it would drive me nuts but I also see some fun. The idea is to load via an SD card reader then paint it .
Great videos. Thank you very much!!!
can you give some idea regarding getting data from an hall effect sensor.I am using it for measuring the speed of shaft.
thanks for your tutorial,i just have one question, there is a possibility to display data that is written on sd card on lcd display like a monitor ?
great video! The link to the card on your website is out of stock on amazon. I found it on ebay but I am trying to find out the capacity of the SD card it takes. I'm wondering how much data I would be able to record. This card is cheaper than the one I found on sparkfun and I wouldn't have to solder pins to it.
Just checking out pin 10 you mentioned and apparently it only has to be set to output to set the SPI mode as Master, once that is done you can use it for something else. SD card file names must use the 8.3 convention (8 character maximum name with 3 character maximum file extension).
Digger D I am really not sure. I don't understand exactly what is going on with pin 10, so I set it and leave it alone. I dont know if it can be used for something else or not.
As I read and think I understood it, it's part of the SPI setup to Master. Once the SPI has been initiated in this mode the pin is free for other use.
this is well understood ... thank you...I tried this with lm35 temp sensor, its worked perfectly...
but its not working for three sensors data logging of DS18B20 ..
please help me out...
What sd card does it work with
Hello... I want to create a table in Excel and save it in the sd card which contains three columns.. The first column is longitude and the second column is latitude and the third column is a number between 0 and 10... then We receive GPS input, and if the longitude and latitude were equal to each of the numbers we wrote in the first column and the second column, it will display one of the numbers (0 to 10) on the serial monitor... Your help is very important to me.
great!!!! very good lessons. how could I put the variable time in the graph ? thank you.
can i use sd card module other tahn u have used.?
by the way vdo is very much good.
request u to clarify
Thanks a ton!
Paul,
If you had multiples sensors logging at the same time, would be better to use raspberry pi?
That pressure sensor is extremely sensitive. Definitely use it as an altimeter
What if I have an SD shield? do i do the same process or do i need to change something
Can we use the same method for electret microphone?
hi sir , i get "SD card initialization failed" error message. what should i do to correct it i used every instruction you provided and still didn't work
thank you brother
Is the sd card thing for micro sd card or normal
Thumbs up definitely! If I tried to do this on my own - it wouldn't work at all
What do i do if i want to make a graph like that in real time?
Just wondering, for scientific measurements, wouldn't you want date and time recorded with each Temp/pressure measurement? The data seems kind of useless without that. I suppose you would need a RTC or GPS connected?
Yes, certainly you would want to save more data and relevant information. The point of the lesson was simply to show how to hook up and write to the SD card. For your project you would decide the relevant information to include.
Could you explain how you could take readings every 10 mins ie a time course.
I think it's through delay(60000) as
delay(1000) = 1 sec.
Can we save the data without having the Arduino ide working? The idea is to make meteo station outside. Using a power bank.
Arduino jusst needs power to run, not the IDE, but power bank will probably turn off since load from arduino is small, you need some sort of battery not USB power bank, which turns itself off.
Hi Paul,
I want to use the sd card to log my rfid module problem is legs are already taken by the rfid module.
question is how to combine both ?
Thanks!
sir, can i connect my usb pendrive (flash drive) as a sd card and store all stufff in it? if yes ,what are the pinouts? basically an usb port has only 4 pinouts right?
so.............is it possible to do so?
Hello paul have a nice day, can you teach how to delete specific log on a file
Hi Paul,
I am working with (Arduino Uno) + (nrflo1) to detect wlan channels. I have followed your steps and I can get the readings from Serial Monitor BUT the readings do not save on SD Card,I don't know why! Do you have any suggestion on this matter?
How to add time and date along with the data in the SD card.
For that you could use a RTC module (Real Time Clock). Then timestamp the data with that.
Hi Paul McWhorter. After seeing this video. I'm thinking about that "how to protect arduino program by password". So do you have any ideal for helping? Thanks
Hi
i wanted to know how to read a csv file from sd card shield with 4 values in row(2 int values and 2 boolean values) from sd card? can you help me with the program
awesome ...
Sir how to transfer .txt file from one sd card to another using arduino?
Thank you so much
Hi! Using only the libraries, the SD writing and one sensor, I ended in 13,000 bytes sketch, which on UNO is a huge room to occupy. Did I do something wrong, or this is the expected value?
For some reason my SD card won't run, if I take out the if statement it will. I even try on your codes and the result's still the same.
sir, what if I want to create the logging interval time become every 1minute? what the code should be create? could you tell me and make the tutorial video please? I need it for my project, I've try my best and the logging interval time still not work as I want
awesome!
does it work the same way id i´m using a micro SD?
The infamous pin 10 works on UNO. Does anyone know what it is for MEGA?
Hi seeking for help in this project currently on going for remote sun logging ,any code done for si1145 uv/ir/lumens sensor with rtc to excel
memory card initialization failed,what may be the possible cause.
thank you