VM211 anyone implemented realtime clock VMA301

The assembly manual states:
Options, coming soon!

  • Arduino compatible 3 colour RGB SMD LED module (2pcs)
  • UV light sensor Guva-S12SD module
  • DS1302 real-time clock module / with battery CR2032 (2 pcs)

Has anyone started to implement the Realtime module VMA301?
It would really improve the value of the logging data.

Got a VMA301 and fitted it in the Earth Listener like this:

Tuck the cable under the Arduino:

First I bent the male connections, like this:

but THAT is not a good idea, they break easily, so in the end I soldered a pin to the wires and isolated them from each other by a small drop of hotglue.
(No picture of that, the box is already closed).

I am using 3 analog pins A13…A15. They can be used as digital pins:

  • pin 67=A13 VMA301 label RST
  • pin 68=A14 VMA301 label DAT
  • pin 69=A15 VMA301 label CLK

So far the hardware. And sofar for now.

Have a look at the library for the VMA301 @ https://www.vellemanformakers.com/product/ds1302-real-time-clock-module-with-battery-cr2032-2-pcs-vma301/.
There are multiple examples who can help you on your way.

One you have the time from the DS1302 sensor in a variable, you only need to change this part of the EarthListener3v4_final code:

/****** poll sensors & update vars + log to SD *****/
// make a string for assembling the data to log on the SD card & add the current time:
String dataString = “”;
char buf[17];
sprintf(buf,"%02d %02d:%02d:%02d",runDays,runHours,runMinutes,runSeconds);
dataString = buf;

This part is writing the runningtime of the EarthListener, you should change that to the current time of the DS1302.

Kind regards,

Why not connect to the same side as the sensors?
The IIC connections SDA and SCL are available there.

1 Like

@Guus.Assmann good question.

I got inspired by the RGB led mounting instructions (did I?).
And I would never install the RGB led.
Do not like leds trying to get my attention :wink:


Hello all,

In case anyone does implement the VMA301 on the EarthListener . . . . .
a link to The VM211 forum item about lighning

There is a link to my github repository to SET the date/time on the RealTimeClock.
And an update proposed to the VM211 firmware to support the VMA301.

Kind regards,

hi Bert,
i have tried uploading your rtc clock update but it didn’t work as it could not find the vma301 library.
you set this as global libraries in your ino, but the system can’t find it on global.
so i downloaded the vma301 libraries separately (the vellman website has the library in the vma301 product page download section) , and created a local library for which i have added a command in your ino as following:

#include “src\vma301_library\DS1302.h” // Hardware-specific library for Vma301

i have put this library folder inside your SRC folder, together witrh the other libraries and it worked.
@VEL342 found out that since you guys implemented the vm211, arduino IDe has changed (and so the libraries), so your old instructions/libraries are no longer found.
you might want to add this to your github folder.
lastly, i dont have a rtc 301 module, so after i successfully uploaded your rtc update, i don’t see ANY change to the interface.
i suppose i would see something once i add a vm301 module?
By the way, does the time/date get displayed on the screen once the vma301 is installed, or is the date/time only stamped in the sdcard log?
lastly, i am currently usinfg the frontal pins you used for your vm301 for the rgb lights, can you please suggest alternative pins for me to install the v301 clock, in a way that it works with your update? (i will be using the free pins behind the screen)
thank you

Hi @Nicdip,

We have not released an official firmware version for the VM211 with VMA301 support, but that doesn’t mean there isn’t one :smiley:

You can download version 4.2 here: https://velleman.bitrix24.eu/~Qniuv
This version adds support for the VMA301 DS1302 module and the VMA354 TUYA IoT inteface that is coming out soon. This will enable your EarthListener to send the values to the cloud so you can monitor them worldwide via the Tuya smart life app.
Both libraries are stored localy and should work without problems. Please note that this firmware build is currently experimental and not officially supported. Like that’s going to stop anyone… but there, we said it :wink:.

If no VMA301 module is installed, the VM211 ignores the functionality, so you’ll see no difference in the interface. If you add the module, the date and time will be used for logging and displayed next to the VellemanForMakers logo. We still need to implement a setup page to alter the time, after some time you’ll see a small offset.

The library that is posted for the VM301 is indeed written for older Arduino IDE’s. You cannot simply use it as a local library, that’s why we used another for the VM211. Like we said before, we do not recommend local libraries, but in the case of the VM211 it’s easier to support because every library change is otherwise a new build.

This firmware adds the VMA301 on pins 35; 37 and 39.
You can use other pins, but don’t forget to change these lines:

const int kCePin   = 35;  // Chip Enable    RST pin on VMA301
const int kIoPin   = 37;  // Input/Output   DAT pin on VMA301
const int kSclkPin = 39;  // Serial Clock   CLK pin on VMA301

Pins 30, 31 and 32 are used for additional outputs. Pins 14 and 15 for the Tuya IoT interface (Serial3).

@bert.test maybe something you might find interesting :wink: .

Happy coding.


Thank you Pietr
For those 15min i felt i was a programmer with that library trick i used LOL!
I will now use the one from the professionals.
I have ordered a vma301, so when it arrives i will try and connect to the relevant pins.
Btw have you got any clue on why my vm211’s tvoc and co2 seem to be higher than normal? (See other post). Thanks

Hi Pietr
I have successfully upgraded to v4.2 and waiting for the vma301 to be delivered before installing it.
I will also look in to this tuya software/hardware you mentioned.

YES! @VEL342 I AM interested. Thanks for the head-up.

All I had to do was set the clock-pin constants. And hey-presto it runs…

Some remarks. (as it is not officiial yet :wink: )
I saw an error on “const” of the logFileName:

EarthListener4v2_not_official\setup.ino: In function ‘void setup()’:

\EarthListener4v2_not_official\setup.ino:294:31: warning: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]


In file included from \EarthListener4v2_not_official\EarthListener4v2_not_official.ino:21:0:

SDmega.h:90:11: note: initializing argument 1 of ‘boolean SDClass::exists(char*)’
boolean exists(char *filepath);

The sketch does compile, but the error confuses me.

There is a challenge: Make the text a bit larger so people like me can read the text. :wink:

Thanks Pieter for another opportunity to fiddle with the EarthListener!

Kind regards,

Talking about font size, i have indeed noticed that in the main page interface, where all the values are displayed at once, the font is unnecessarily small. There is lots of space on that screen, perhaps increasing the font and reducing the icons size would help making the homepage more usable.
Also, it would help if the refresh time of the sensors could be slower.
Normally thermometers do not refresh every 2 seconds, they take much longer, and maybe they display the average number of many readings, which would make the final displayed temperature more accurate.
It is not very appealing seeing a temperature that goes like
22.0 22.5 21.8 22.3 etc continuously.
The same should apply for the barometer, as barometers are typically very stable and air pressure typically changes in the matter of several minutea/hours, surely not seconds.

I received the clock module vma301.
I connected the pins correctly but I don’t see any time displayed on main interface page.
Pics of my installation below.
35 is green
37 is yellow
39 is orange
Ground is red
Vcc is brown

All matches on module too (see colours- mind that the sensor is upside down inside the case)
@VEL342 i connected the Vcc to the 5v.
Did i have to connect it to the 3V instead?
(Pics also show how i connected the led, elegant solution in my opinion. I have also found the perfect place for the vma301 inside the case)

@VEL342 could it be the fact i dont have a sd card installed that makes the earth listener ignore the presence of the VMA301?
I wanted the clock for time keeping, not for log purposed, so not planning to install the sd card at the moment.

I was expecting to have the time showing near the Velleman logo after installing the vma301, but nothing happened.

Hi @Nicdip,

The time should be displayed regardless of using an SD card or not.
Please check the wire connections;

Brown VCC 5VDC
Orange CLK 39
Yellow DAT 37
Green RST 35

If these are correct, please notice that you need to parse the correct time into the RTC first. Otherwise, the data from the RTC will be wrong and ignored by the EarthListener.
To set the time of the RTC:

  • Navigate to the setup.ino file inside the EarthListener folder

  • Uncomment line 312 - 322, so change this:

    // Init a new chip by turning off write protection and clearing the clock halt flag. 
    // These methods needn't always be called. See the DS1302 datasheet for details.
    // Make a new time object to set the date and time. Example: Saturday 14th of December 2019, 22:52:00
    Time newT(2019, 12, 14, 22, 52, 00, Time::kSaturday);
    // Set the time and date on the chip

To this:

  // Init a new chip by turning off write protection and clearing the clock halt flag. 
  // These methods needn't always be called. See the DS1302 datasheet for details.
  // Make a new time object to set the date and time. Example: Saturday 14th of December 2019, 22:52:00
  Time newT(2019, 12, 14, 22, 52, 00, Time::kSaturday);
  // Set the time and date on the chip

And don’t forget to change the line Time newT(yyyy, mm, dd, hh, mm, ss, Time::kDay); !

  • upload the code to the EarthListener
  • change the block above to the original (commend that part)
  • upload again.

RTC should work now.


Time showing now. Wires were indeed correct but i had not changed any code, that’s why it wasn’t working!
I didn’t really understand why i had to change the code and put the time first and then reupload the original code without the time (as per your instructions), but that goes to show how ignorant i am on arduino programming!:joy:
Thanks for all the help Pietr, now earthlistener working 100% and very happy with it.
Looking fw to checking future releases of FW as i reckon the unit can still give a lot (graphs, historic charts and whatnots!)
Keep up the good work

1 Like