stuartpittaway / WebastoHeaterWBusArduinoInterface

Arduino software for controlling Webasto ThermoTop heaters over its custom WBUS protocol
26 stars 15 forks source link

documentation & use exmaples #1

Open general-albatross opened 8 years ago

general-albatross commented 8 years ago

Hi Stuart, Do you have any further documentation on wbus protocol used on Webasto and maybe some use exapmles for your library you can share? Regards, Thomas

stuartpittaway commented 8 years ago

Hello, think you are the first person to ask!

I've not picked up this project for a while, but I did managed to get my heater to fire up and run. My goal was to create an Arduino based controller with an LCD display - this is what the code on GITHUB does.

Most of my code logic comes from reading the topics and ideas on this page

http://sourceforge.net/p/libwbus/discussion/756917/

On Fri, Jan 29, 2016 at 9:54 AM, blackphoenixinf notifications@github.com wrote:

Hi Stuart, Do you have any further documentation on wbus protocol used on Webasto and maybe some use exapmles for your library you can share? Regards, Thomas

— Reply to this email directly or view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1 .

Mogensen76 commented 8 years ago

Do you have any schematic?

Br Johnny

stuartpittaway commented 8 years ago

Yes, see this project.

https://github.com/stuartpittaway/WebastoWBUSInterface

Mogensen76 commented 8 years ago

Thank you very much :-)

boelle commented 7 years ago

a long time ago...

but has any tried to add a gsm module to the mix?

stuartpittaway commented 7 years ago

No I don't think so

On 18 Sep 2016 19:58, "Bo Herrmannsen" notifications@github.com wrote:

a long time ago...

but has any tried to add a gsm module to the mix?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-247866299, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9Wnh5FOAqLsxPrjI_XFHUiIHYONZks5qrYm-gaJpZM4HPEkl .

boelle commented 7 years ago

well i have the hardware... only need a levelshifter between gsm and arduino (the mega) and also i like a L9637D to do the conversion between the wbus and arduino

and i need to dig out some sample code for the gsm part

stuartpittaway commented 7 years ago

Should be fairly easy to do. Let me know how you get on

On 18 Sep 2016 20:05, "Bo Herrmannsen" notifications@github.com wrote:

well i have the hardware... only need a levelshifter between gsm and arduino (the mega) and also i like a L9637D to do the conversion between the wbus and arduino

and i need to dig out some sample code for the gsm part

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-247866711, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9RXFp-GC9U3VKOklE7ZH2RIyLkDAks5qrYtkgaJpZM4HPEkl .

boelle commented 7 years ago

will do....

how would you judge this code? http://pastebin.com/9jEW030e the wbus.h for that sketch: http://pastebin.com/8e8JQdX0

a bit different from the one you use.... i dont have a clue which one is the better one here

its from another project that might be better suited for the task...

but i take any advice i can get

EDIT: https://www.youtube.com/watch?v=6zZjSFef4yA

a demo of it... not my work...

boelle commented 7 years ago

my plan was to cut out code that i do not need, then add in gsm stuff

and try to find documentation on the strings that webasto uses for status etc, with some damn great luck i can use their app to control it :-D

stuartpittaway commented 7 years ago

Looks okay, memory size is the biggest problem when using LCD screens and interfacing to other devices.

On 18 Sep 2016 20:22, "Bo Herrmannsen" notifications@github.com wrote:

will do....

how would you judge this code? http://pastebin.com/9jEW030e

its from another project that might be better suited for the task...

but i take any advice i can get

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-247867733, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9ejWVdnkSDoCpPa8v4C87hte6Zb3ks5qrY9DgaJpZM4HPEkl .

boelle commented 7 years ago

oki doke

lcd is going out and this will be hidden either under the dash or seat

only need to get some components to do level shifting... the GSM module is on 2.8V so it needs slight adjusting before it will work right

btw... is there a complete list of commands i can send the preheater? just so i can figure if there are any other nice stats i can get out of it or the sketch i found will make do

stuartpittaway commented 7 years ago

I've not found a reference manual as such, there is a link in my source code to the site where I found most information from.

On 19 September 2016 at 10:06, Bo Herrmannsen notifications@github.com wrote:

oki doke

lcd is going out and this will be hidden either under the dash or seat

only need to get some components to do level shifting... the GSM module is on 2.8V so it needs slight adjusting before it will work right

btw... is there a complete list of commands i can send the preheater? just so i can figure if there are any other nice stats i can get out of it or the sketch i found will make do

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-247943455, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9X8P1fn8mjNlPO0-UX1Jv_QoNnXaks5qrlCngaJpZM4HPEkl .

boelle commented 7 years ago

oki, wil try and have a look

when i come up with a sketch will you have time to look it over and suggest corrections?

what i'm after is to get all "dead" code out

but it will not be before next month, to busy right now to so much more

stuartpittaway commented 7 years ago

Happy to take a look.

On 19 September 2016 at 10:51, Bo Herrmannsen notifications@github.com wrote:

oki, wil try and have a look

when i come up with a sketch will you have time to look it over and suggest corrections?

what i'm after is to get all "dead" code out

but it will not be before next month, to busy right now to so much more

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-247952035, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9Wx68D596T8YB8CckEeHNsrhYg-nks5qrlsJgaJpZM4HPEkl .

boelle commented 7 years ago

bored enough that i started to have a hack at the code

http://pastebin.com/kNdYcnyN

this is just for a few hours of work, the lcd stuff is slowly going out to be replaced with texting commands to the arduino and it sending status back

Q: there are 2 get status voids.... are the variables in those accessible from the main loop?

i ask because i cant remember and i want to send the sms/text from the main loop if i can... but if not i will have to do it from the get status void

boelle commented 7 years ago

or is the it the other way round.. ie variables in the main loop are available in the get status voids ?

if that is the case no problem... i guess it would make sense to send the sms from there anyway...

if i call the status voids once they are done i will be returned from where i left off in the main void right?

a bit rusty so sorry for asking questions

stuartpittaway commented 7 years ago

Yes I think you are correct, not 100% following, but I think you are on the right lines.

On 20 September 2016 at 14:51, Bo Herrmannsen notifications@github.com wrote:

or is the it the other way round.. ie variables in the main loop are available in the get status voids ?

if that is the case no problem... i guess it would make sense to send the sms from there anyway...

if i call the status voids once they are done i will be returned from where i left off in the main void right?

a bit rusty so sorry for asking questions

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-248307023, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9TYwRCcuyRTxHhK_6yM4MxQzJW61ks5qr-TdgaJpZM4HPEkl .

boelle commented 7 years ago

where do i loose you?

boelle commented 7 years ago

what i mean is that sometimes variables are not "useable" in the main loop... it fails and says that its not declared etc...

my problem here is that when i get the text in the main loop it stores the number of the sender in the number variable... so my plan is to call the get status void... then send the text from within the void and use the number variable to tell who should get the text

boelle commented 7 years ago

my sketch so far... have started to mark lines that might be dead code

http://pastebin.com/ie806tp5

will continue tomorrow... any headsup are welcome

boelle commented 7 years ago

tried to compile and it works except one line i commented out

http://pastebin.com/zP6qdPNp

any recommendations? did i get {} right in the main loop?

my logic for the main loop is that it checks for an sms... if it gets one it will check what the word in there is and carry out the action set... so far i just have start, stop, status1 and status2

if no text it received it will do the keepalive command but of course only if the heater has been given a command to start

and also it will check if there are a flame... if so it will send a text to say that the heater did light up

i will add some logic that send a text when the temp goes above say 60 degrees telling the car is ready to go

boelle commented 7 years ago

figured a few things and my code is now this: http://pastebin.com/KYRJXCbQ

have removed what seems to be dead variables in the beginning.... but any advice on cleaning it up more would be very welcome

raldred commented 7 years ago

@boelle thank you ever so much for sharing your code, i'm really very interested in this. Did you build your own wbus interface board or use an off the shelf Arduino canbus shield like the one from sparkfun? Would you mind sharing some pictures of the wiring or maybe a schematic Thanks

stuartpittaway commented 7 years ago

Hi Rob, my wiring diagram is on Github as well. https://github.com/stuartpittaway/WebastoWBUSInterface

On 11 October 2016 at 12:29, Rob Aldred notifications@github.com wrote:

@boelle https://github.com/boelle thank you ever so much for sharing your code, i'm really very interested in this. Did you build your own wbus interface board or use an off the shelf Arduino canbus shield like the one from sparkfun? Would you mind sharing some pictures of the wiring or maybe a schematic Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-252892066, or mute the thread https://github.com/notifications/unsubscribe-auth/ABJW9Ye2ZXWLbrWUCyrXns8qJZj3vsvZks5qy3MQgaJpZM4HPEkl .

boelle commented 7 years ago

Hi

I will build my own, its not complete yet but it will be an eagle schematic thing

raldred commented 7 years ago

Ohh thanks @stuartpittaway that's great!

boelle commented 7 years ago

http://imgur.com/a/B2iMx

the black circle is the connection to the heater.. above is serial connection to GSM module

to the left is 2 dc/dc converter modules of the kind you find on ebay... a 15V suppresion diode to catch the most nasty spikes.. and a fat 22000uF cap to prevent to much drop when starting the engine

at the very top some leds to indicate status locally

not on there yet are some DS18B20 temp sensors for the cabin and outside

boelle commented 7 years ago

also missing in my code is a routine that checks if the gsm module lost connection and if so power cycle the gsm module

and the code i build this on only have TX line defined as far i can see... i wonder why as normally you would have a RX also

boelle commented 7 years ago

my code is based on this youtube video.... code is far down on the comments list..

but in the top ones i just got an reply that TX should be connected to RX/digi0... that is how i understand the authors reply

raldred commented 7 years ago

That's sounds really impressive. I arrived here from your comments on the youtube video :) I'm actually only interested in heater control via my SIM900 i don't want/need anything else in the vehicle.

boelle commented 7 years ago

then we are going for the same goal... i just want the extra status leds so i dont have to send an sms all the time... i might add 2 buttons to turn it on/off locally

but some code that checks if the module is connected to the gsm network would be awesome... starting the engine has the risk of throwing the gsm off the network

raldred commented 7 years ago

@boelle I have dropped your code onto a gist maybe we could collaborate there rather than on pastebin. I've just tided up the formatting a bit for now. https://gist.github.com/raldred/c9e9a592e6ed341af6c060fcf26cbe23

boelle commented 7 years ago

no problem

what i would be most interested in right now is a "void" that can check if there is connection to GSM network and if not power cycle the module

raldred commented 7 years ago

during the loop maybe add a check for gsm.available()>0

boelle commented 7 years ago

i use this lib: https://github.com/MarcoMartines/GSM-GPRS-GPS-Shield

they have some examples but they are pretty "thin"... and i actually asked if this was possible but no answer...

but maybe its better to go for the standard gsm lib that comes with arduino?

can we do these "chats" on gist also?

raldred commented 7 years ago

Hi @boelle, Just wondered if you've made any progress? I have now got my circuits built up, going to run some tests with the code. I was just wondering why you're not initializing the wbus Serial1 during setup? image

I have also been investigating using a HC-06 Bluetooth serial instead of the sim900

boelle commented 7 years ago

No not any progress as i ran out of money... not sure if i will get anything done before Xmas

Did not init wbus serial as the code i started out on did not do it... i have blindly copied off the code from the youtube video... maybe that was my mistake

http://pastebin.com/9jEW030e

and the guy also posted an alternative wbus.h

http://pastebin.com/8e8JQdX0

boelle commented 7 years ago

but i have come up with a PCB design

http://imgur.com/a/HsHLN

that is one to take care of the input side

-power -DS18B20 for temps in car and outside car -wbus chip instead of several components

there are pads on the edge that connects to the mega... but i have a few uno chips arround and maybe they can be used instead... but then the code would have to be changed to use softserial for both gsm and wbus and not sure if softserial can do that

i only miss the chip and board... if a bit lucky i will find money for that during next month. I also have to replace florescent tubes in an old monitor... its the continuous juggle with money when you are without a job

raldred commented 7 years ago

Very nice. Are you producing the IC chip yourself? So far I have just built up the circuit on veroboard as per Stuart's design, as yet I have not tested, need to work on the code.

I'm think I'm going to use a Leonardo or uno. So I'll also need multiple software serial ports at least during testing so I can have the USB serial connected. Some work will be needed to switch between the software serials because only one can listen at a time. It is possible though: https://www.arduino.cc/en/Tutorial/TwoPortReceive

Seems like it would be possible to do the GSM/Bluetooth Serial processing first. Then switch to the wbus serial and listen on that, then repeat.

boelle commented 7 years ago

No the chip is a common one :-D

raldred commented 7 years ago

Ohh really, I've tried looking for it here, do you know it's code?

boelle commented 7 years ago

code?

you dont program it...

datasheet:

http://www.st.com/content/ccc/resource/technical/document/datasheet/4a/80/83/26/e0/78/4d/18/CD00000234.pdf/files/CD00000234.pdf/jcr:content/translations/en.CD00000234.pdf

raldred commented 7 years ago

I mean the IC package number. L9637 Thanks!

On Mon, 24 Oct 2016, 13:52 Bo Herrmannsen, notifications@github.com wrote:

code?

you dont program it...

datasheet:

http://www.st.com/content/ccc/resource/technical/document/datasheet/4a/80/83/26/e0/78/4d/18/CD00000234.pdf/files/CD00000234.pdf/jcr:content/translations/en.CD00000234.pdf

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-255731493, or mute the thread https://github.com/notifications/unsubscribe-auth/AACQ6Hf3Eusbij8G_zvEPbHC6ZrQ8nDVks5q3Kn1gaJpZM4HPEkl .

boelle commented 7 years ago

:-D

i could have build it with more resistors and transistors but i want to do it as clean i can... it takes me longer but i think it will be worth in the end

i thought of bluetooth but then again i would have limited range :-/

raldred commented 7 years ago

True, for me 30-50m is plenty.

On Tue, 25 Oct 2016, 19:14 Bo Herrmannsen, notifications@github.com wrote:

:-D

i could have build it with more resistors and transistors but i want to do it as clean i can... it takes me longer but i think it will be worth in the end

i thought of bluetooth but then again i would have limited range :-/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-256117156, or mute the thread https://github.com/notifications/unsubscribe-auth/AACQ6IPDpGbw0-TGzwS5FTfgmNY3eXwIks5q3kcVgaJpZM4HPEkl .

boelle commented 7 years ago

but once i get the PCB's done i hope you can help me a bit with the code should i get in to trouble

if the code i came up with work i would be interested in a routine that could power cycle the GSM module if it loose connection to GSM network.

adding DS18B20 sensors should be easy enough

raldred commented 7 years ago

Great. I'll let you know how I get on.

On Tue, 25 Oct 2016, 19:23 Bo Herrmannsen, notifications@github.com wrote:

but once i get the PCB's done i hope you can help me a bit with the code should i get in to trouble

if the code i came up with work i would be interested in a routine that could power cycle the GSM module if it loose connection to GSM network.

adding DS18B20 sensors should be easy enough

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/stuartpittaway/WebastoHeaterWBusArduinoInterface/issues/1#issuecomment-256123596, or mute the thread https://github.com/notifications/unsubscribe-auth/AACQ6N0STCOsnC6jPKyn8tctrJogUuAhks5q3kkggaJpZM4HPEkl .

raldred commented 7 years ago

No joy unfortunately. I've tried using your code @boelle as a base and nothing. And I've reworked @stuartpittaway to remove the need for the screen and nothing there either.

Can't get anything over the wbus, it just times out.

Keeping heater alive
wbus_init
wbus_init
wbus_init
Reading sensor failed
wbus error
Err 0xffff

I've had my meter on the circuit and it seems like the voltages are good and it's switching the transistors but it's not connecting to the car. (Land Rover Discovery 3)

boelle commented 7 years ago

hmmm....

since it's factory installed maybe its one of those heaters with canbus.... how and where do you connect? just guessing wild here