Page 1 of 1

I need save datas in a SD Card with a Blue pill.

Posted: Wed Nov 18, 2020 8:54 pm
by FerroFerido
Hello, i'm neubie about STM32 but i really like Arduino and others Boards. I need save the value temperature of ten sensors in a SD Card in TXT format, but i don't know who do it. Anyone can help me? I'm using STM35F103C (Blue Pill) and i'm programing with ST-link V2. (i'm sorry for my horrible english)

Re: I need save datas in a SD Card with a Blue pill.

Posted: Thu Nov 19, 2020 6:37 pm
by mrburnette
The general idea of Analog pins on the Blue Pill:
https://www.electronicshub.org/how-to-u ... 2f103c8t6/
... ADC in STM32 Blue Pill board is configured for 10 Channels i.e. you can use the 10 Analog Input pins to measure 10 different analog voltages.
STM32F103C8T6-Blue-Pill-Pin-Layout.gif
STM32F103C8T6-Blue-Pill-Pin-Layout.gif (59.67 KiB) Viewed 5218 times
So, 10 thermistors, 10 series resistors, an SD Card, software. Something like this but with the output of the NTC thermistors going thru the algorithm:
https://www.ametherm.com/thermistor/ntc ... t-equation

I would strongly suggest you start slow with just 1 analog port. Send the results to the serial port. After you have that correct, build out the other 9 analog circuits, one by one.

When you get all 10 values on the console, then implement the SD Card recorder.

Note, you can "fine tune" each thermistor using software, or you can pay more money for precision 1% thermistors and resistors. There are other sensors too that can be used for temperature measurements:
https://www.google.com/search?&q=arduin ... ure+sensor
https://randomnerdtutorials.com/9-ardui ... -projects/

Here is an Adafruit thermistor tutorial.


Good luck,

Ray

Re: I need save datas in a SD Card with a Blue pill.

Posted: Fri Nov 20, 2020 5:14 am
by FerroFerido
i'm really thankful. You really help me. Last doumbt, the BluePill board has a two SPIO channels, SPIO1 and SPIO2, Who i can select the SPIO2 for use with SD Card, it's just select CS pin when i start the SD card or i need declared the others SPIO pins, like Miso?

Re: I need save datas in a SD Card with a Blue pill.

Posted: Fri Nov 20, 2020 12:36 pm
by GonzoG
There no SPIO. It's SPI. And there are 2 SPI interfaces.
Depending on library you can select which SPI it uses or it uses only SPI1.
SPI1 is on pins PA5-PA7, SPI2 is on pins PB13-PB15 (usually only MISO, MOSI and SCK pins are used).
For CS you can use any pin or NSS (PA4 for SPI1 or PB12 for SPI2).

For STM32F103 blue pill Arduino SD library is the easiest to use: https://www.arduino.cc/en/reference/SD.
It's using SPI1 only.