Ducati.ms - The Ultimate Ducati Forum banner

21 - 40 of 47 Posts

·
Registered
Joined
·
373 Posts


Oh wow.

A few immediate thoughts:
» Wow this is epic.
» Instead of Arduino, you'll want to use a ChipKit since those can actually work fast enough to make acceptable graphics. Plus there's a framebuffer library for it.
» You can use resins and molds to easily make the final dashboard. What's great is that you can sand and finish a 3D printed part and that now-perfect finish will become the master part.
» We need something like GitHub, but for code, CAD drawings, and documents. (I hate github, too, it's too hard to set up work flows)
» Once the software and electronics requirements are finalized, we'll figure out the lowest price hardware that can run it. We probably won't need a custom PCB made, since the crucial restraint will be the display.

On the software for the screen:
» If each function were to be made into modules, it could be easy for the user (person riding the bike) to add and remove functions.

And in case you didn't notice... WOW!
Chris
 

·
Premium Member
Joined
·
86 Posts
foske, this is impressive work. I strapped my iPhone 6+ over my dash during a track day to run Harry's Timer in conjunction with a Vbox Sport for timing and realized how lacking the displays are on most bikes. I'll be watching your thread with interest.

Out of curiosity, do you know how to trick the light sensor into thinking it's always dark? I'm guessing it's a matter of covering up the sensor but I'm not sure if it's accessible within the display. I find the recessed display on my '12 M1100 difficult to read. That would be a small victory if the display were easier to read.
 

·
Registered
Joined
·
30 Posts
Discussion Starter #23
Thx Chris, just a quick response to your suggestions:
The main focus of this project was adding navigation, and there are a lot of good navigation software out there on Android. So I would like to stick with Android for that part. So the only thing that the Arduino is doing, is forwarding the canbus messages, graphics are handled by Android. Currently I'm using a Motorola G right know, but it's definitely an overkill. The Chipkit sounds interesting. Do you know any projects that run navigation software on the Chipkit?

The resins and molds suggestion sounds interesting, i'll check it out.

For the software, at this point a created a Android service, that broadcasts the data. So adding screens or functionality is relatively easy. (Even for different apps I believe)
I would like the use the hardware buttons on the handlebar to switch between screens. So I ordered a couple of opto couplers to hook up to the electrical system, because I don't believe there on the bus. Just as the indicators.

@quito: Thx! I didn't had the change (courage) to write data back. I think that the sensor and back light are a closed circuit inside the dashboard, but I don't know for sure.
 

·
Registered
Joined
·
503 Posts
Yep, interesting stuff. :) Although he is running into the same CAN problems we did or the datalogger. I gave foske my optimized libraries to try fixing some data corruption errors. (I ended up GPLing the libs since as far as I know, nobody else has coded the silicon fix for the MCP2515 controller.) All roads lead to Rome. :p

We need to kick these projects into gear. Many have been languishing for years simply because all the info was too spread out. foske still needs to verify his PID assignments, and I'm asking MrCanBus is he will host the master spreadsheet. I need raw can dumps to help him, though... valid, clearly documented ones.

Do you think you can volunteer CannedIce's bike as a test mule? I can send you the plugs you need to plug the ChipKit logger into the harness, and the code to log to SD (once I port MrCanBus's one).
 

·
Registered
Joined
·
503 Posts
SPREADSHEET BEING CORRECTED:

................
Ignore everything I said there. Damn, I wish this forum let you edit technical comments.... :mad:
I ran through your datalogs and updated my spreadsheets to MrCanBus's site. I located (I think):
  • Speed (ABS + ECU, 2 copies -- 1 might be the front wheel encoder for DTC)
  • RPM (ABS + ECU, 2 copies -- may be related to DTC)
  • TPS (2 copies -- 1 may be APS for DTC)
  • Time + Mileage + Dash Text
  • Neutral + (Possible) Sidestand + Run switch + Clutch
  • Engine temp + Air temp
  • Air pressure
  • Voltage
I still need your help logging data. I don't even own one of these. :p
A lot of the above are just educated guesses. Very educated guesses, but guesses nonetheless.
 

·
Registered
Joined
·
30 Posts
Discussion Starter #26
I've been working a lot on fine tuning the project on all fronts. 3d, Arduino and Android. A lot of help came from Impulsive_duc, so a really big thanks for that! We made good progress on identifying the data that is on CANBUS, https://docs.google.com/spreadsheets/d/1-NJ9OlGQYTGMzBzwDPYn-aI_7_ign9SCiscKZufx3Uw/edit?pli=1#gid=813963652 and it's very cool to see that the gear indicator is already on the BUS. But we are missing some semi important stuff like indicators and fuel indicator.
I also got my new 3D printed revision from the local printing shop, FabLab Breda and it all fits really well, even the screw holes are an exact match! :surprise:

And to top it off, a small movie that shows the "racing" interface with a running engine:
http://1drv.ms/1GS17nI

The next step is of course some bug fixing, but also I need to tackle the electronics so I can take it for a spin :grin2:
 

Attachments

·
Registered
Joined
·
373 Posts
Thx Chris, just a quick response to your suggestions:
The main focus of this project was adding navigation, and there are a lot of good navigation software out there on Android. So I would like to stick with Android for that part. So the only thing that the Arduino is doing, is forwarding the canbus messages, graphics are handled by Android. Currently I'm using a Motorola G right know, but it's definitely an overkill. The Chipkit sounds interesting. Do you know any projects that run navigation software on the Chipkit?

The resins and molds suggestion sounds interesting, i'll check it out.
Ah, navigation, right. THAT will be on Android... but now I need to wrap my mind around the concept of how to blend an MCU (chipKIT, arduino, etc) with it. Because if the coding for Android is generic enough, that takes the GUI work out of the embedded platform...

Chris
 

·
Registered
Joined
·
30 Posts
Discussion Starter #28
I'm currently using the USB-Can Pro v5.0 protocol, implemented in Arduino by Impulsive_duc. The Android part is reading this byte stream. I already created a simulator that uses records files instead of the USB connection, that eases the Android developement a lot. Creating a BT connection would be very easy to implement as well. I think this is be a great way to decouple the system. It does need a way to talk back to the arduino though, because at this point it is one way only..
 

·
Registered
Joined
·
503 Posts
Keep in mind I coded the libraries to that "USB CanPro v5.0" format not because it is the best or most efficient, but because it was readily available. I could have just as easily used the CANard or CANtact protocol, but felt they were a bit wasteful using ASCII chars instead of a byte stream. Also, they are being "weird" and haven't published a clear API... you have to manually dig through their code to understand it.

foske, I still have your old Android code where you used a CSV bytestream. Did you rewrite it to do the high-level processing in the Android device?
 

·
Registered
Joined
·
30 Posts
Discussion Starter #30
Yes I did. I just send you an update from the project. Maybe i'll need to change it the protocol to something smaller. If I'm sending everything to the SPI/usb host, I will get interrupt overflows. Not really checked into it though..
 

·
Registered
Joined
·
30 Posts
Discussion Starter #31
Today I finally finished the first draft of the electrical wiring. It contains a relay connected to the plate light to make sure it doesn't drain my battery and a DC/DC converter to (hopefully) prevent the Arduino from blowing up. Time for a test drive, but first the TT of Assen this weekend :surprise:

 

Attachments

·
Registered
Joined
·
373 Posts
foske, wow, very impressive work! I've been buried with things at work so haven't been keeping up.

More thoughts, though it means more changes :p For $9.38, you can have 256k flash, 80MHz cpu and integrated CAN controller. Built in CAN means it runs like 10x faster than an Arduino shield. I own 2 of these (and 4 or 5 of the much lesser $4 PSoC 4 boards that are still 5x an Arduino). That $9.38 board equates to about $100 of Arduino stuff... but the trade off is you'll need to work a little harder to get things happening.

So the $9 board is a Cypress PSoC5 prototyping platform. As you've already learned, dedicated "pins" on the Arduino suck. This guy has like 30+ pins and you assign them to where you want inside the IDE! All of my Arduino projects end up with a Pro Mini laying near the other parts with wires soldered into place, so Arduino "pins" & shields are redundant. (example) The only advantage of Arduino and "shields" is quick access to I/O. But more than one "shield" and you get screwed. I end up bending pins out (or cutting them off) and soldering jumper leads to mis-used or re-used pins anyway. (example). So if that was convincing enough, this page is the home-base of All Things that board. And I'm down to help you finger out the new path. Arduinos are great and all... but "real" hardware like this and ChipKIT? Wow, we're talking Ninja 250 vs Ducati Streetfighter!

There's tons more info to say or write, so I'll save it for that phone call if/when you go there. :)

Great job though, WOW!
Chris
 

·
Registered
Joined
·
30 Posts
Discussion Starter #33
Hi Chris,

Thx for the feedback! I'm already exploring the options for different hardware, pricing isn't the biggest obstacle, but size and easy connectivity is (and examples :))... At this point, I need a platform with the following options:
- Android ADK (usb host controller) support
- CANBUS
- Basic I/O(I have a set of opto couplers, for everything that isn't on the BUS, like Blinkers/Oil/Fuel indicators)
- A bit more power than the UNO to make sure the can bus isn't flooded.

If there is a platform that has it all on board, that would be my weapon of choice, any suggestions on that? Or a platform with integrated Host controller/ ADK support?

I'm currently looking at the following platforms:
- Teensy (Already has a CANBUS controller, and examples the work as a host controller)
- Android Mega ADK (bigger in size, but one shield less, but still a slow processor)
- Chipkit (the network shield is needed for the ADK as far as i can see, which is also pretty big in size)
- Cypress (does it work with ADK? any examples on that?)
 

·
Registered
Joined
·
373 Posts
On CAN, it may not entirely be the CPU's fault regarding keeping up. Part of the problem are the popular CAN shields for Arduino use a slow crystal. And if you don't set up filtering properly in the controller, you're not using the hardware and are just throwing CPU at the problem. The key with the ICs is to let them help you; the problem is diddling with their settings to learn what works for you and what doesn't.

Except for the NXP (I talk about that below), microcontrollers (mcu's) with built in CAN controllers are going to need a CAN transceiver to drive the CAN bus. Thankfully, as I have found out, this isn't too hard and you just need the MCP2551, etc, and wire it up to make it happy. (it would appear you can assemble one via discrete components, too)

--------------------------------------

About "other hardware" probably the biggest hurdle will be coaxing the CAN controller to work. ChipKIT's MEGA has a built in CAN. I see you believe the shield is needed for ADK. That may or may not be "required", as shields normally just break out pins and provide physical connectors. The suck is they put it on the Arduino Mega form factor, which is stupid huge, and then charge $50 for a pcb and small connectors.

Cypress's $9 CY8CKIT-059 has CAN controller capability as a module you can drag and drop into the universal blocks. Some guy published a PDF of how he did it. Then just wire up a mcp2551 like I did and hook it up to the right pins. The Cypress might have an advantage here in that the IDE's GUI configures the CAN controller's registers, so you don't have to do all that in code. As far as Android ADK goes, it probably works?? This guy makes psoc things work with android. And there's this.

The NXP OM13012 board showcases their LPC11C24 with a 50MHz Cortex-M0 and built in CAN controller AND transceiver, which is unique among the dev boards out there. $19 is a pretty awesome price, too. I googled and here's someone saying it can talk ADK. (data sheet). Note that it combines 4 or 5 similar dev boards, pay attention to the LPC11C24 sections. And the C means CAN.

NXP's IDE is big but not as crazy as Cypress's. I was able to change the blink rate of the LED sample program reasonably quickly. (like in a day?)


--------------------------------------


Of the IDE DEV platforms I have used, I'd rank them in this order from easiest to hardest.
1) Arduino
1) ChipKIT's mpide
3) NXP
6) Cypress
9) Ti Launchpad

Ti is in 9th because I wasn't able to create a build environment within 2 days of trying. If I can't build the demo blinky program, it's kind of a fail.
 

·
Registered
Joined
·
503 Posts
Hey, I thought I'd chime in since I've been MIA for a while.

It all depends on the level of performance and functionality you need.

If you don't need to read every single packet a slower processor might be enough. Hell, even a ELM327-clone dongle might be sufficient. Then you can throw out the Arduino stuff completely. The type of work I'm doing with Chris requires not a single packet is dropped, EVER. So I wrote my own library for the MCP2515 (SPI => CAN) from scratch to achieve this performance. This is definitely possible even with the limited bandwidth (10Mhz SPI shared) of Arduino CAN shields.

However, if all you want to do is read the speed twice every second (2Hz) you don't really need that type of hyper-optimization. The problem with ELM327 clones is that they tend to have shitty voltage regulators to cut costs. Like a linear 5v voltage converter burning 1W of current. These are bound to fail and burn up. And again, in a LIVE VEHICLE BUS you can't afford this type of thing. You need something proper like a Buck step-down voltage converter (as you used).

The second problem with ELMs is they are clones of variable quality. Some have commands that behave as you expect, others have weird undocumented behavior. Even the "first party" clones like OBDLink MX have weird problems.

As for the Teensy, the problem I have with that is unlike the MCP2515 which is a seperate IC, they are sharing a common main code loop. They aren't using a RealTimeOS with multiple threads. As a result, the Teensy effectively only has 1 RX buffer. You miss a message, it's gone. The MCP2515 on the other hand has 3 RX buffers. There is a benefit to offloading tasks like CAN communication. It means your MCU can be busy doing one thing while the IC is busy accepting/transmitting CAN frames. The hard part is syncing them all up in a timely format. Interrupts are terribly inefficient in ArduinoLand so I have been brute forcing it with MCU speed. If I hop on the Cypress/NXP bandwagon this will be a moot point.

If you want help with using an ELM, give me an e-mail again. I can walk you through the serial protocol it uses.
 

·
Registered
Joined
·
30 Posts
Discussion Starter #36
Sorry for the late reply, besides a long holiday it's been pretty busy around here.. But I've managed to find some time to work on the project!

And thanks for hardware suggestions, as my experience is not in electronics, it looks like Arduino and Chipkit are still the best options (or as Impulse suggested, just a normal ELM327 dongle, but it misses the extra input options for blinkers, oil etc..).

A small update on what I did manage to do last week: At first, I was experiencing a lot of instability problems with the USB Host controller. Getting the "OSCOKIRQ failed to assert" which suggest that there is a problem with the usb.init. I found a lot of references on the internet that this means there is a power supply issue, which is pretty plausible because it's connected to motorcycle battery. After playing with the voltages with no proper result, I finally found out that the problem was in the Serial output speed :) In the example that impulsive send me, he used the boosted 2000000 serial speed. This will interfere with the usb host. After changing it back to 115200 everything worked a lot better. So I did manage to drive around and found a lot of simple bugs regarding the non-existence of unsigned int's in Java. But these were easily fixed and this means we have a pretty good basic system:
- RPM
- Speed
- Engine Temperature
- Navigation
I'm missing blinkers, oil and fuel, so that’s next on the list.

There is still some stability problem in the USB host, which I can't really put my head around. Sometimes after 3 minutes the connection is lost, but I also did a 20 min drive without any problem. So that something that I need to figure out.
@Impulsive_Duc, I've just send you a new logging set, just doing a small trip around the neighborhood, hope you can do something with it. Because logging is done on the android, we have a few missing packages….
 

·
Registered
Joined
·
203 Posts
Anything happening with this topic? I'm very interested in pursuing it further with my S2R.

Anyone with the 3D printer files for the phone holder?
 

·
Registered
Joined
·
30 Posts
Discussion Starter #38
So, it’s been ages (almost 5 years) and to be honest I don’t know if reopening an old topic is appropriate but I did dust of this old project and wanted to share my progress and some of my insights.

The main reason that I continue to work on this old nemesis project was that I wanted to create a fully functional dashboard, because putting it on top of the existing dashboard will always be a bit sloppy. This means the scope of the project changed quite a bit since the last update. So the main focus areas are:

Focus one:
Get rid of the old dashboard and build my own keeping all the wiring original.

Focus two:
The navigation suppliers (TomTom, Mapbox, Google) all supply a good sdk these days so I would like to use a sdk to build one app instead of hovering over an existing one.

If you want to get rid of the dashboard, you need to do something about the immobiliser. You could flash the ecu so it won’t check for it, but there is an ‘easier’ way.
This guy Adventures with the Ducati CAN bus did the trick on his 848 and it also works for the 696. Sending:

0x20 {0, 0, 0, 0x4F, 0xA1, 0, 0, 0};
0x80 {0, 0, 0, 0, 0, 0, 0, 0};

Will let the bike start and run without dashboard. You do need to add the canid 0x80 message. You can keep it empty because it is only relaying TPS as far as I can tell because no wire is running from the throttle to the dashboard and 0x81 is still broadcasting it.

Now we can start the bike with an Arduino and without the original dash. Yeah!

Next is trying to figure out what to do with all the cables running into the dash. This is really not my expertise and I always tried to stay away from the electrical part. But now I decided to just go for it try If I can make it work.
This what the wiring looks like:

987033

987034


And you need to do a bit of trick to read stuff like blinkers and the mode button:
987035
987041

And then you can blink the original lights with a p Channel mosfet:
987040


As I have enough analog pins on my atmega, I used a simple voltage divider to measure the voltage. 0v connected to ground, means Left, 12v means right. Floating means nothing. R1 is added to make sure floating is not a wild guess, but a steady value. These values can handle a peak of 19v, so I might be changing them to a bit higher numbers. They were originally pick because 11v means 3,3v. This is just above the digital read threshold 3v of the Atmega328.

To make it all fit, I Started using Kicad to design a PCB. Based on the hardware that I was using. So an ATMega328p, an mcp2515 and max3421 usb host IC. I did consider changing it to let's say, a STM32 chipset, and this could be an advantage because you can get CAN and USB host in one chip. But for now this setup works and changing to different development stack is not worth the effort for me.
987037

And finding the right connector was hard, so for future reference, this is a Molex 75757-1401:
987038


So this is an early stage but I'm thinking about sending the PCB to JLC for manufacturing after some more sanity checks.

Also I did some prototyping with the Mapbox SDK and I added a movie I found on Vimeo to as a loading animation. Uploading your own loading animation good be good feature. This is what the navigation looks like from the app:

Things I don't know / remarks / need to figure out
- What are de possible DTC / check engine error codes that I can expect? Under what kind of can bus id’s are the broadcasted?
- Does oil and fuel just give a simple 12v high or is do need to read them differently?
- Did I do enough to protect my circuits from voltage spikes
- I did not include a chip for the immobilizer, the original dashboard has PCF7991AT. It could be a future addon, but for now i will add some security in the phone (perhaps fingerprint identification?)
- redesign a new case. probably with a bigger screen. And should this be with a removable phone, or a dedication one?


@fch99 : I don't know if your still interested, but you can have de cad files. but they nee quit a bit of tweaking if you want te use them, I would not recommend to use it in its current state.
 

·
Registered
Joined
·
2,695 Posts
everything you said is over my head, but posting it is important because any info and particularly highly specific info is good info.
 

·
Registered
Joined
·
373 Posts
@foske WOW HOLY CRAP

That's awesome work. And your report shows how difficult it is to "just do something" that "is easy enough, right?" 😆🤣😆🤣 I have lots of experience with Arduino and ESP32, outstanding job!

  • I believe the oil pressure switch is a simple switch. The fuel level is reported with a thermistor, like this one. There's a thread about it, too.
  • For voltage protection, I'm not 100% sure the best means, but probably a great answer would come from Stack Exchange or r/ElectricalEngineering. There has been talk on the Hypers about the CAN bus getting spikes that kill the ECU and/or gauges.
  • About built-in CAN hardware, almost no MCU comes with the driver onboard, so you normally will still need a MCP2551 or similar to interface with the bus. The tell-tale sign is when it has a CAN pin instead of CANH and CANL. I started to play with CAN on Ducatis but didn't have a specific goal so didn't really do anything with it.
  • Is your "read_turn_signal" signal the gray wire on pin 17?
  • You can use Arduino IDE to develop for ESP32 it's speed, power, and RAM will be a great inexpensive upgrade. Also has built in BT and WiFi and is possible to update over the air (but I haven't researched that at all).
Dumb question: do you keep sending these on the CAN bus or only once?
0x20 {0, 0, 0, 0x4F, 0xA1, 0, 0, 0};​
0x80 {0, 0, 0, 0, 0, 0, 0, 0};​
 
21 - 40 of 47 Posts
Top