Customize the VM204

I have several questions regarding the VM204, hope somebody could clarify my issues:

I would like to make some simple adjustments to the VM204, this by changing some lines of code in the Javascript and / or CSS that run inside the controller board. How can I compile and upload these lines of code to the VM204 board to customize the layout and functionality of the controller board?

For example, In “Notification” at “Analog” I’m able to set an Alarm Value ( threshold ) that sends an email every time the input voltage goes above the threshold and triggers the alarm. In my project I would like to do the opposite, I would like to send an email every time when the input voltage goes below the threshold.

Do the adjustments in the code ( JS & CSS ) have an influence on the smartphone app? Or does the app has it’s own layout? Meaning that the app won’t take over any layout adjustment made in the controller board itself. For example I’m only using the pulse function buttons and not the toggle buttons, so I would like to disable them in the layout.

Another thing ( I think it’s a bug in the VM204 ). In “Customize” you can fill out several fields that are displayed in the “Relay Status” In “Analog” there is also a field that can be filled out, but it doesn’t appear anywhere in the final layout ( Relay Status ), is that correct?

The VM204 lacks a in depth manual on how to customize the controller board…

Hi

For the CSS and JS you can enter an url to the files in the customize field. You must host the files on your own (raspberrypi,NAS,…).
The CSS and JS will affect the layout in the app. Because the app is literary browsing to the VM204.

For the analog notification, unfortunately the triggering is fixed in the firmware as you can see here => github.com/Velleman/VM204-Firmw … ain.c#L578
You can edit the firmware and upload your own. You can find the complete firmware here => github.com/Velleman/VM204-Firmware
The name of the analog input is not shown on purpose. Because it would be weird showing “Temperature : 2.35V”
But the name is remembered if you check the network data you’ll see a file passing by settings_json.shtml which holds all the settings and there you can find the name.
So by writing your own JS you can make the name visible and even calculate the analog value to your unit.

The manual doesn’t go as in depth in the technical stuff because people use 90% of the time the standard controls.
If someone knows what CSS is and how to write it, most of the time they can figured it out on their own.

If you have any other question i would gladly answer them.

VEL337

Thanks for the input. I’m more of a hardware guy so I need a little bit more help on this one.

If I know what lines of code I need to change in the firmware to customize the vm204 to my needs. How do I compile this ( firmware ) into an HEX file so I can upload it to the controller board? What software tool ( Mac or PC ) is used for this?

The other option is the CSS and JS url in the customize field. Also not clear to me yet. Does this replace one of the CSS & JS files ( for example the vm204.css & vm204.js ) in the controller board?

I know these questions are very obvious for most coders so I really appreciate your input, thanks.

I’ll try to make a customized version for the analog alarm

You’ll need the Microchip MPLABX IDE and the XC32 compiler if you want to build the software yourself.
For the programming part you could programmer it with a Pickit 3 or a ICD3 programmer.
Or use the Firmware Upgrade Tool delivered with the VM204.

As for the CSS and JS, they will be added to the existing code. In the source code you’ll see the lines

and So when you put the URL in the CSS and JS field in the customize section. These will be added in the href part so they will look like this The code will be executed after all the rest is executed

Best Regards
VEL337

Things seem to be more complicated then I expected.

So to change things you need to compile on a chip level. I thought I could change some lines of code in the vm204 CSS & JS ( that can be found inside the firmware files ) and compile it in a HEX file with a Software Tool. And then upload it through the USB port of the controller ( like an Arduino controller ). But that doesn’t seem to be the case or am I missing out on something?

So there is no simple way to change some lines of code in the “index.shtml”, “vm204.css” and the “vm204.js” and then upload it through the USB port of the controller?

[quote=“CarloJongen”]Things seem to be more complicated then I expected.

So to change things you need to compile on a chip level. I thought I could change some lines of code in the vm204 CSS & JS ( that can be found inside the firmware files ) and compile it in a HEX file with a Software Tool. And then upload it through the USB port of the controller ( like an Arduino controller ). But that doesn’t seem to be the case or am I missing out on something?

So there is no simple way to change some lines of code in the “index.shtml”, “vm204.css” and the “vm204.js” and then upload it through the USB port of the controller?[/quote]
Below an image example I’m going for. Velleman should make it more easier to customize the layout. Take Webrelay ( controlbyweb.com/webrelay/ ) for example. You can disable buttons and outputs from your layout without programming. It is made possible in the main program to disable unused items from the layout by a click of a button in the main settings. I miss this function in the vm204.

PS Thanks for customizing the alarm below threshold issue.

Hi

If you could send me the shtml,css and js files i can included these with the new firmware.

VEL337

Thanks a lot, you can download the JS and sHTML in the next link:
we.tl/IC46uMJpLL

I didn’t change anything to the CSS so it’s not included in the file.

Only thing I didn’t know is how to change the decimal value. I’m reading an analog value of an LM35 for the temperature ( 10mV/°C). So now I’m reading 0.23 instead of 23.00 for the degrees celsius.
Can this be changed as well?

Thanks a lot for looking into this.

is it correct your control button is activating the pulse button? Or has this to be a regular toggle i.e ON/OFF button?

The control buttons are Pulse buttons. They give a 1 sec pulse via the vm204 relais to an optocoupler circuit that powers on the devices ( PC, NAS, GPU Rack 1&2 ).

Ok

Just wanted to be sure.
The analog low alarm is working and I implemented it.

Thanks a lot.

Wouldn’t this be useful to all users of the vm204? To be able to trigger the alarm either by going above or below a given threshold. To enable this function in the settings so they can choose how the alarm is triggered.

Yes sure

Ok I’m back with your firmware!
I’ve implemented some other features to :slight_smile:
Here’s your custom version:
www73.zippyshare.com/v/lWoBTKl2/file.html

Use the firmware upgrade tool to upload the firmware use the non unified version.
If you have a pickit laying around you can upload the unified version and you’ll also have the new bootloader version.

Just to be sure please give the card a factory reset after programming it. So all settings are written correctly to the flash

Best Regards
VEL337

[quote=“VEL337”]Ok I’m back with your firmware!
I’ve implemented some other features to :slight_smile:
Here’s your custom version:
www73.zippyshare.com/v/lWoBTKl2/file.html

Use the firmware upgrade tool to upload the firmware use the non unified version.
If you have a pickit laying around you can upload the unified version and you’ll also have the new bootloader version.

Just to be sure please give the card a factory reset after programming it. So all settings are written correctly to the flash

Best Regards
VEL337[/quote]

Thank you so much for the custom firmware. Now I don’t have to deal with unwanted buttons.
Thanks again :slight_smile:

I think there is still a bug in the program concerning the Alarms.
If I select the Analog Low in the Notification, set my email addres and the Alarm value: for example 41.
Then when I press the save button the Alarm value jumps back to the default 64.
The same with Analog High. If you fill in an Alarm value in the Alarm High situation and try to save it. The Alarm value then jumps to the default 128.

I assume this is a bug?

Hi

Yes that could be a bug. I hope i can fix it in the next week.

Best Regards
VEL337

Ok…

I better wrote next month.
Expect the fix in the coming days.

Best Regards
VEL337

Hi

here you go =)
It was easier than i thought.
downloads.velleman.be/b791faeba9 … Custom.zip
(The link is valid for 7 days)

Best Regards
VEL337

Hello
You could by a flag, disable a relay type of excitement?
in practice or just having impulse, or just activated deactivated
Thank you