Developers geek talk – part 1

This post is not about the ZOE, Fluence or Kangoo Z.E., but about what it takes developing something like CanZE. Imagine debugging this beast without a car systems emulator on your desk and no Bluetooth emulation in Android Studio. The process goes a bit like this:

  1. Think of some great feature you always wanted to implement;
  2. Program it;
  3. Conclude you made some silly errors;
  4. Back to 2, when done…
  5. Download it to your phone;
  6. It crashes immediately;
  7. Back to 2, when done…
  8. Walk to the car, unlock it, wake it up, start Canze, wait for it to pair with the dongle, open your great new screen;
  9. It crashes immediately;
  10. Close car, kill remnants of CanZE, get back in the house, sit down, connect phone to USB only to conclude the crash post mortem is gone from the phone’s memory. Back to 2. When done…
  11. Notice it doesn’t do exactly what you intended. Often you’re now back to 1 instead of 2, as you need to think again where you conceptually went wrong. Sometimes that means creating entire new data structures. And all the existing functions need to work;
  12. It works! now at least test some of the old functionality!
  13. Old functionality is broken;
  14. Fix it. back to 10

And I am not even talking about version control, releasing, managing changes between developers. It is a far from complete list, but you get the idea: it is a tedious process often taking place in the hours after midnight.

As I am working on a major change involving getting more diagnostics data from the car I decided enough was enough. I build a special piece of hardware based on a “Wemos D1 mini” processor and a “HC-05” Bluetooth interface (eBay is your friend). It connects my WiFi network directly to the KONNWEI dongle in the car. The processor acts like a web server and all the primitives CanZE can ask the dongle, this little computer can too. In essence it is initializing the dongle, getting a free frame or a diagnostic command. Wemos runs about 1000 lines of C code to do that, part of which is very similar to the ELM327 driver in CanZE. Though CanZE is Java of course……..

This little thingy is now in the window sill near the car, while my desk is at the complete other end of the house. Total hardware cost is under 10 Euros, but of course many hours went into programming it. The Wemos is a fantastic implementation of the ESP8266 processor by the way, but I digress.

Next on my list: Modify CanZE (see process above!) so it can use http to get the data from the car. Not only would (notice that I am not saying “will”) that enable me to run CanZE from my phone while still at my desk, but it should also enable us to finally run CanZE in the Android Studio device emulator. There is one minor thing left though. The car must be awake for this to work. That usually means it should be on and started; in some cases, it just charging is enough. Oh well, we can’t have it all can we?

4 Comments on “Developers geek talk – part 1

  1. We all appreciate a great work from you and your friends.
    Why didn’t you use a konnwei wifi adapter ? instead of making your own.It would enable all of us to have our cars online while charging. πŸ™‚

    • Well, at the time we started discovering on how to read the CAN bus and decrypting the received messages, Bluetooth chips were cheaply available. This is why we went that road. After all, as BT is not an option on the iPhone, the iPhone app uses a WiFi dongle. Whit the introduction of this self-made (and self controlled!) element, CanZE might learn on how to use a WiFi dongle too. You never know were the road ends up πŸ˜‰ … so maybe I could be wrong as well. We will see …

      Either be patient or start coding yourself, whatever comes first πŸ˜€

    • Android cannot connect to the internet over the cellular network and at the same time connect to a specific device over WiFi. Of course I could switch devices in the car but that would not be practical at all.
      A few other reasons:
      – I want to use this gateway later for my permanent energy management. So it will be even more impractical switching devices (two dongles in parallel is against my principles πŸ˜€ ).
      – Wifi Dongles behave like access points, not as clients. I would have to make a gateway anyway.
      – I wanted to play in a useful way with the Wemos. It is a very powerful and practical device. Learning by doing.

      You are making a good point, but for practical reasons, it won’t work for the goals I have.

  2. Then make a http webserver in canze software witch would run in a dedicated phablet in the car.
    One could simply acces the car’s webpage for info on charging …
    Or, better, made canze compatible with “mysensors” protocol for easy integration in to smart house controller πŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

*