Yes!
STM32 + CAN is working. Now working on decoding the messages and creating a correct response.
Does anyone know if there is a “third party” device ID to use? Or should I just fake an existing module?
Decoding in action:
Greetings Matthijs
Yes!
STM32 + CAN is working. Now working on decoding the messages and creating a correct response.
Does anyone know if there is a “third party” device ID to use? Or should I just fake an existing module?
Decoding in action:
Greetings Matthijs
You can fake existing modules, it all depends on what values and functions you want to be able to send and receive from other devices.
A dimmer could also be used for a PWM dimmer for leds or for volume or tone control.
You could make your device to listen to multiple channels and combine on/off commands with values such as dimmer values.
Have fun experimenting with it.
Jeroen.
Made great progress over the last days. Now have a “STM32” based VMB8PB module working.
The STM32 responds to the “scan” request with the module type.
Also the status request messages are answered.
Also all comands to read / write the memory have been implemented (although it now writes the RAM of the STM, so everthing is lost on power down). Have to check how to write the EEPROM of the STM32.
When I press the button, the corresponding channel message is send.
Memory map of the VMB8PB is extremely simple, so that helped a lot.
Cleaning up code and then see if I can made a motion sensor input. Much more complicated as there are a lot more settings to handle.
See you,
Matthijs
Dont know if any one is interested, but made another huge step.
Made a VMBPIRM module and now can write & read flash of the STM with the data from VelBusLink.
So VelBusLink can write & read back the settings. I treat the parameter list as a blob (512 bytes) of data for now.
Of a few parameters I already know what they mean.
Next step:
Grtz Matthijs
Update:
Proto hardware is up and running. Blue pill with a modified CAN driver board. The regulator will be replaced by a DC-DC upcomming days. This one runs hot.
Will add the motion sensor tonight. Everything still fits in power socket in the wall.
Most likely will make a custom PCB later on. Think I need about 5 of them around the house for motion detection. But this board can simulate any VelBus module if needed (and invested enough time to make it work).
Greetings Matthijs
1st module installed & working.
So things are looking pretty good. Used the same switch covers as used in the rest of the hallway.
Might be looking for some more fancy “glass” likes on aliexpress.
Also designed a PCB to reduce the wire mess on te back of the module. This makes it also easier to multiply the design.
The STM32 board goes underneath this board. Kind of piggy bag board. Power supply from 15 VDC to 5 VDC (CAN & motion) and down to 3.3 V for the STM32. 2 red blocks are screw terminals for the 4 bus wires.
Grtz Matthijs
Another update. Things are working!
The PCB I made with 5V and 3.3 V regulators and MCP2551 driver.
STM32F103 on the back side.
So the hardware is working and fits inside a junction box in the wall.
Bought a motion sensor with glass look on aliexpress. Removed the electronics and place the new module in there.
Now playing around with the software. Still some bugs to fix. Also I implemented only a limited set of features.
Want to use the same board (and software) to mimic an VMB8PB module too, so have to make some more changes to the software. That project will follow soon.
Grtz Matthijs
Progress!
Currently have 4 DIY Velbus like modules operating in the house.
The UBS interface which I created is 99% compatible (must be some hidden features which I overlooked, so no 100%). But both VelBusLink and Velserv are happy with the interface and work perfectly with it.
The VMB8PB emulator sends its status every few seconds. This is done to enable development of the other modules and have some triggers to respond to.
Plan is to start developing an “VMB4RYLD” output module. But as output modules contain the “rules” / “actions”, this module will be much more complex to emulate compared to the VMB8PB module.
But has been great fun so far and @Ggaljoen joined the team.
Ofcourse we will not be able to “clone” the original VelBus hardware 100%. But that is also not the purpose. Adding a few DIY modules to the existing genuine VelBus is enough. Meanwhile we are having great fun and learning a lot about STM32 too.
Grtz Matthijs
Another update…
@Ggaljoen helped the project and made a logger which displays the CAN data on the bus onto an LCD screen. The screen is a “standard” arduino project which uses an STM32 too, and he added extensive logging to the velbus modules. Basically this logging is the same as the one found in VelBusLink, but then in hardware.
Logging is working so good, that Gert is going to make a dedicated logging VelBus module. Very handy when debugging the commands. And can be installed in the VelBus installation permanently.
This will definitely increase the “nerd” level of the VelBus system and impress my non-technical friends and make their heads explode. Just like the screens in the matrix movies.
Will post more on that later.
Greetings Matthijs
Really nice and interesting work Matthijs!
Would it be possible to create a microwave sensor that can be hidden in the ceiling for motion detection that can attach to the bus?
@matthijsfh Fantastic work! Please post if you have any updates or anything you can share: code, PCB plans, documentation, etc. It would be a shame if it got lost! I’m gathering info if it’s possible to make a swimming pool chlorination and pump controller (*) (a few digital and analog signals) and looks like what you’ve done is perfect starting point
(*) controller might not be the best word - interface for monitoring and commanding the actual controller provided by the vendor of the system.
Hai,
Not much progress. Most of my “modules with the same velbus interfaces” are working good enough to keep the wife happy
I did make a 5 channel output module. It has the basic behaviour of the VMB4RYLD, but only with the basic relay commands (no timers, no special stuff. On/Off/Follow and forced on/ off.)
Works well and saves me quite some money. The original modules are > 200 EUR each. So have a few official modules and now some DIY to get more IO on the bus.
Also finding the limits of the way I implemented the code. As I did not know how to start, my code is not optimal now things are getting very complicated. So the moment to call it a day is coming.
1 Thing on the list is to use the STM32F103 spare capacity better and have multiple Velbus modules running on a single STM32F103. “Only” 5 outputs is a waste of uP real estate.
Greetings Matthijs
With the new ESP32 types (before you got stuck with the lower limit of 50kbps) , you can communicate with other Velbus components.
My 2 cents:
WiFi bridge between 2 parts of a Velbus network. So connect a local network (in my garage) over WiFi with the main network in the house.
Any other ideas! Please let us know!
Interested in helping? Please let us know!
Greetings Matthijs & Gert.
I’ve only just seen this.
Jeroen’s VelServ can do this already.
If the second unit is set to slave mode.
Has anyone here actually managed to get ESP32 (V2 or 3) talking to velbus at 16.6 kBd?
I just ended up in some sort of Windows installer/IDE hell. VScode IDF components complaining that they didn’t have permissions to update or Arduino IDE libs not working at these low baud rates and cross compilation and python tools installed in very strange places so they don’t work from normal command lines and I cannot see how to set environment to use them directly.
I can see how to get the extra divide by 2 and modify an existing arduino lib but I can’t see how that is sufficient to get down as low as 12.5 kBd like the Espressif docs seem to suggest their SDK can manage. What has happened to arduino since ESP32 and MBED came along and they started wrapping everything? It used to be simple.
If anyone has an ESP32 simple example before I go crazy that would be great.
Alternatively I did manage to get Raspberry Pi Pico talking to Velbus fairly easily using Kevin OConnor’s can2040 driver (a software implementation of CAN2.0 good for up to 1MBd). That is fine but since the Pico Wifi has a ESP32 on board for the WiFi part that seems a bit unnecessary.
It is possible in the Arduino IDE to get it down to VelBus speed with the TWAI library, but a 1 digit change is required.
The file twai_types.h has a config for 16KBITS, the parameter “tseg_1” should not read 16 but 15.
What do you have in mind for the ESP32 (S2/S3/C3), a special use case in the make?
I see… so they push the bit-read right out to the end? With the extra /2 and BRP=62 and TSEG2 still 1, I make that maybe 16.7 KBd … which is probably close enough?
Which arduino CAN/TWAI library are you looking at?
The “arduino-CAN” library I found on github does not use twai_types.h; it just has a switch on the speed that sets the BTR1 and BTR0 register values but the settings for < 40kBd don’t work of course because the BRP ends up being more than 6 bits. It does not seem to to use the IDF driver support… just talks to the SJA1000 regs directly.
I have a few Wemos D1 Mini (ESP-WROOM-32 v3) on the shelf here and some older ESP-PICO-KIT development boards. I do not have anything in particular in mind yet… I just thought I would try a few different approaches (rPi-Pico, ESP32, STM32) for entertainment… to see which was simplest and most useful.
After messing around with painful Espressif and ST dev tools and VS-code all on Windows I think what I would most like to do is write a simple 8-bit AVR software driver instead :-/
Having ESP32 WiFi would be cool though… bound to be useful.
The espressif Arduino-ESP32 support from; Installing - - — Arduino ESP32 latest documentation
So far for the simple part?
There is a serious potential with the newer versions, my test did work on a ESP32S3 (have my doubts about your ESP32 v3 even being compatible).