- Read values from sensor
- Read from SD card with iSDIO
- Send values from arduino to Raspbery Pi
- Visualize on Raspberry Pi
Last time we measured temperature and humidity with DHT22.
Before sending measurement results, Modify FlashAir's iSDIO library.
Support FlashAir iSDIO and SD card function both
FlashAir Developers:Arduino tutorial
However, in this tutorial, the SD card access function is killed.
So, we have to enhance the library by our selves.
- First, Download the tutorial source code and unzip the archive.
arduino_tutorial_06.zip - Copy the following files from Arduino's standard SD card library into the unzipped "iSDIO" folder.
File.cpp, FatStructs.h, SdFatUtil.h, SdFile.cpp, SdVolume.cpp。
Then, copy SD.cpp and SD.h, and rename them to SDExt.cpp and SDExt.h.
After that, the iSDIO folder becomes like this.
- Open SDExt.h, SdFat.h, SdVolume.h in the iSDIO folder and replace the word "Sd2Card" with "Sd2CardExt".
- Open File.cpp and SDExt.cpp in the iSDIO folder and replace "SD.h" with "SDExt.h".
- ZIP compress the iSDIO folder.
- In the Arduino IDE, select the below menu and load the ZIP file.
Scketch - Include libraries - Install .ZIP library
I put the modified iSDIO library in GitHub.
GitHub - onthehand - iSDIO
How to use the modified iSDIO.
SD storage access with the iSDIO library.#includevoid loop() { File file = SD.open("file.txt", FILE_READ); : file.close(); delay(1000);
"SDExt.h" is included instead of "SD.h".
Plus, delay is added after SD card access.
I don't know why, but WiFi connection seems to become unstable just after SD card access.
Other than that the way to use is the same as normal SD.h.
When using FlashAir's WiFi with a modified iSDIO library,
the following points are needed than the tutorial of Flash Air Developers site.
- Include "SDExt.h" instead of "utility/Sd2CardExt.h".
- Do not declare "Sd2CardExt card;" as a global variable.
- Change all "card" object to "SD.card".
ex) "card.readExtMemory" to "SD.card.readExtMemory".
Originally, card object of Sd2Card is a member variable of SD class.
So, after SD class (SDExt class) becomes available, the object should be accessed as a member variable.
If it accessed directly from out of the class, its behavior becomes unstable.
OK, next time, send sensor data via WiFi.
Many thanks for your project description. It was useful for my project.
ReplyDeleteI have it half working now: code that write from Arduino to FlashAir SD works while FlashAir WiFi is on. I can see the files on SD in the webbrowser of my laptop.
Arduino code that reads data from SD FlashAir works also, BUT the FlashAir card drops WiFi: the laptop cannot connect to FlashAir any longer. I can't get it to work.
Do you have come across this problem?
Hi, Jan.
DeleteThank you for your comment.
You use FlashAir as follow, don't you?
- FlashAir SD card is mounted on Arduino.
- Arduino accesses FlashAir as SD card (not GPIO device).
- Your laptop accesses FlashAir as HTTP server via WiFi.
If my understanding is correct, I recommend to use the original FlashAir library of FlashAir developers. (not to use my customized library)
https://flashair-developers.com/en/documents/tutorials/arduino/
I guess several root causes, if the same issue occurs in spite of the original library.
- Arduino power shortage.
WiFi needs high wattage than simple SD card.
If your arduino connects to other device/sensors,
it might be over the power supply capacity of arduino.
- FlashAir's processing ability shortage
I do not understand completely FlashAir's behavior.
FlashAir might have not enough processing ability
to work hardly SD and WiFI at the same time.
I'm so happy, if my comment helps your challenge.
Hi, I am trying to setup an arduino with an SD card reader. I would like to use a Toshiba FlashAir 16GB card and read the card via the WIFI while the arduino is collecting data and storing it on the flash drive. I could successfully read/write a regular SD card with the standard library, but not the FlashAir card.
ReplyDeleteI used this setup and software:
http://henrysbench.capnfatz.com/henrys-bench/arduino-output-devices/arduino-lc-studio-sd-card-tutorial/
I tried to use youe modified library, but it did not work either. I can connect to the WIFI on the SD card, but I am unable to connect the arduino with the card.
Any suggestion?
It seems that FlashAir WiFi function is unstable during SD card writing/reading and after that.
DeletePlease insert a few second "delay" after writing/reading.
Let me know detail error message or information, If it does not work even with delay,
suspect a power source problem. I just followed the instructions on the above web site, but I think it is not appropriate to use the 5v on the Arduino Uno board. I also realized that the file writing is not working even with a regular sd card, which is a more power consuming operation, than just reading. I assume the FlashAir requires even more power than a regular sd card. I am not sure about this power source problem, because the wifi access is actually working. It may be simply a voltage level problem, since the card is actually using 3.3 logical level and not TTL. I read a lot about problems with the sd cards on the net, but I still have no clue.
DeleteThank you for a good suggestion.
DeleteI found a solution of Arduino power source issue for FlashAir, but it is a Japanese blog, hmmm...
http://powerele.sblo.jp/article/182349083.html
In summary, he says as following.
- Because FlashAir needs high current, a regular Arduino Uno becomes unstable.
- Some Arduino compatible boards have an improved power regulator.
- As the result, he removed a regulator AMS1117 from his regular Arduino, and then replaced it to BP5293-50.
His hack is non-invertible, so I don't want to take such a solution...
I keep detecting some other solutions.
I am planning to use a 3.3v arduino mini pro and I will make its power supply and for the sd card too from a step down dc-dc power supply like this:
Deletehttps://www.ebay.com/itm/3-3V-3A-Mini-Step-Down-Power-Supply-Module-DC-DC-Converter-Input-7V-28V-Output/311886109092?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m2749.l2649
This comment has been removed by the author.
ReplyDeletedfsdf
ReplyDeleteMerkur 20C Review - Xn - Ng
ReplyDeleteMerkur 20C Review - Xn · Merkur 20C. 메리트 카지노 쿠폰 The Merkur 20C is a stylish and efficient all-round adjustable หาเงินออนไลน์ safety razor. · The worrione Merkur 20C is a