Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How efficient is the RTC in STM32F051 and 030 series?

Status
Not open for further replies.

shubh1196

New Member
I'm trying to make an IoT based project that works on Real-Time data accumulation, for that, I need to know whether the STMF0 series controller are efficient or not.
 
Unless you can guarantee the board will never lose power, I'd advise you use an external RTC IC with its own battery backup connected, so you can set the main controller time when it restarts.

eg. An MCP7940 is cheap and simple to use via an I2C connection.

One of those should run for a decade or more on a single CR2032 lithium coin cell.

It also allow the main controller to be in a low power mode or "sleep" without concern over messing up the real time clock.
 
I'm trying to make an IoT based project that works on Real-Time data accumulation, for that, I need to know whether the STMF0 series controller are efficient or not.

It all depends on what you mean by "efficient"?

I have not used an STMF0 controller and I was browsing this Application Note on the RTC. It appears to me to be very efficient and flexible and with many features. I do not, however, see any provision for a battery backup on just the RTC.

The MCP7940 was already mentioned and I would add to that the DS3231. I have used both of those - building the simple circuit as well as buying very cheap boards. They are convenient and easily used with a battery back up. I should add though, that those RTC chips may lose some accuracy over long periods of time and that could be a consideration. I would speculate that the STM RTC does as well.

If you did not want to add another board and work with I2C, AND it is an IOT project, an alternative that might work is to contact a Time Server on power up (and other times if greater accuracy is needed) and use that accurate time to set/reset the STM RTC. I used that approach recently (see here). Completely different controller, but you get the idea.

The advantage of the latter approach is that if power does go out, the time is set when it is restored - I also assume that the data logger is not running when the power is off. The disadvantage is that you have to connect to a time server and make sure that error and recover routines are hardened.

Hope this helps.
 
If you did not want to add another board and work with I2C, AND it is an IOT project, an alternative that might work is to contact a Time Server on power up (and other times if greater accuracy is needed) and use that accurate time to set/reset the STM RTC. I used that approach recently (see here)..

I do similar, but don't contact a timeserver (as such), I call a PHP script running on my webspace, and get the time from that - along with other information as well, such as if updated settings are available to download.

The PHP script is a lot simpler to do, as you simply run the script on the webserver, and it returns a short string with the time and date (and nothing else), and you can write the script to provide exactly what you want.

An issue with the DS3231 modules is their rechargeable battery - if you're running at 3.3V then the battery won't charge - but apart from that they are excellent, and more accurate than most over (non-server) methods as they are temperature compensated. I usually set them to output one second pulses, and use that to wake the PIC from sleep - just as I do with the 32KHz TMR1 clock on a PIC.
 
It is a bit off-topic, but...

An issue with the DS3231 modules is their rechargeable battery - if you're running at 3.3V then the battery won't charge ...

You may mean (I am guessing that you do) these boards (bought on for less than US$2). I have had a couple of discussions about them.

RTC1 20191210_142016.jpg


Not trying to start and argument, everyone finds their own way and all that, but my feelings have not changed....

"The big issue with the board is, fortunately, well known…it has a charging circuit for the battery on board. That is, it sends Vcc to the battery through a diode and 200 ohm resistor. Apparently, it is designed for use with an LIR2032, but note that some do not think charging would work well depending on Vcc. I am not concerned because I don’t care to use a rechargeable battery.

I removed the resistor and installed a CR2025 (that I had handy) and it should also work with the higher capacity CR2032 (same size). It seems to me that installing a CR2032 without removing the resistor or otherwise removing Vcc to the battery is a distinctly bad idea - and there are reports of swollen CR2032s after a few days. I did verify that Vcc (minus the expected drop) is at the battery terminal when powered (without the battery of course).

Once you get rid of that charging business, it is a decent DS3231 board, especially for US$1.82.

There is much available on this board, but here is one of the better sources that I found https://thecavepearlproject.org/2014/05/21/using-a-cheap-3-ds3231-rtc-at24c32-eeprom-from-ebay/ and here you can get the schematic as well as some relevant datasheets https://www.play-zone.ch/en/combo-b...ratur-zeit-24c32-memory.html?___from_store=de"


I have no rechargable coin cell batteries and I just don't want to deal with charging circuits. I do like the EEPROM though.

I prefer this style:
RTC2 20191210_142248.jpg


No EEPROM, no charging circuit and you have a choice of whether to install the pull ups.

Although, using the DS3231 is so easy, you can also just make your own circuit (pride of making I suppose because the boards are cheaper than the components - at least in my case).

RTC3 .jpg
 
You may mean (I am guessing that you do) these boards (bought on for less than US$2). I have had a couple of discussions about them.

Although, using the DS3231 is so easy, you can also just make your own circuit (pride of making I suppose because the boards are cheaper than the components - at least in my case).

Exactly, it's cheaper to buy the module than the parts.

As for fitting non-rechargeable batteries, as you say it's essential to remove the charging resistor.

Going back a long time, an old Grundig VCR used to use a battery (NiCd) backed I2C clock chip - one of the VERY few VCR's that didn't forget the time when unplugged. In common with all the NiCd backup batteries they used to die, Grundig proved a modification for it - you removed the battery and charging resistor, and fitted a non-rechargeable battery :D The life of the non-rechargeable was longer than the NiCd's lasted anyway.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top