1. Attachments are working again! Check out this thread for more details and to report any other bugs.

MFD Replacement?

Discussion in 'Gen 2 Prius Accessories & Modifications' started by jdh2550, Aug 20, 2012.

  1. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    I think you're right about the button press capture being simple enough (once we're sure about the actual underlying clock speed and parity details) but to fully support all the climate control functions you'd need to be able to read the current state of the climate control ECU to see what components are on at what levels, and to know the current interior (and ideally exterior) temperatures. I'm not sure if we can catch the MFD polling for this info (maybe when the Climate page first loads?) or if those are just periodically or asynchronously sent out over the bus (in which case we'd need to figure out how to pick out those signals from all the other unrelated traffic on the bus and decode them.)

    The AVC-LAN stuff does seem easier to tackle, but unless I'm missing something it also doesn't gain us much since the original head unit is going away. I've got a bit of microcontroller experience under my belt and could probably get that circuit you linked going without too much trouble, but it's not something I'm going to prioritize.
     
  2. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    This looks interesting, it's an abstract of a project by some Fujitsu engineers to create a "Gateway ECU" that sits on the BEAN bus and allows communication to/from external devices:

    http://www.fujitsu-ten.com/business/technicaljournal/pdf/12-5E.pdf

    According to the paper this device was actually manufactured and sold "with an anti-theft security system for the 1998 model of a European vehicle," so this is a thing that was mass-produced at some point. Another interesting thing mentioned in the paper is encryption; the translation isn't great, but they seem to refer to an implementation where communications meant for the alarm system are encrypted by a rotating key, while other communication is sent in the clear. I hope I'm right in that interpretation, and that Toyota has stuck with this approach rather than just encrypting everything! I'm not sure I have the spare time or expertise for a cracking project in addition to everything else.
     
  3. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
  4. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    Dollars to donuts the transmission of everything else is clear. When you're building a gazillion cars you don't want to have add encryption/decryption handling anywhere unless it's absolutely vital.

    I think you're right - although AVC-LAN is probably "easier" to figure out we'd be better served by figuring out BEAN. However, we could achieve what we wanted by creating an MFD replacement sitting on AVC-LAN and talking to the Gateway ECU. We'll let the Gateway figure out how to control the A/C ECU (remember just because it's called "Gateway" doesn't mean that it doesn't do other things as well like split one "high level command" like "set temperature to X" to several lower level commands - yes, that stuff is probably done in the A/C ECU but we don't know yet...).

    But, if we can crack it at the BEAN level then we have a leg-up on other things like the Meter ECU and other stuff. And the Meter ECU is where the ambient temperature and other interesting stuff comes from. See attached...
     

    Attached Files:

  5. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
  6. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    You know, for some reason I'd been operating on the assumption that the MFD had a connection to the BEAN bus and used it to communicate with the A/C ECU directly, but of course it makes more sense that it'd be connected to the AVC-LAN and go through a gateway for climate control. I'd be thrilled to get things started with emulating the climate controls of the MFD, and if we can see those by sniffing the AVC-LAN bus so much the better. Maybe I'd better look into an Atmel dev kit after all.
     
  7. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    If I were you I'd just go with the DuinoMite Mega - mouser and digikey have 'em for about $40. Yes, we'd have to convert the software for the AVC sniffer - but that should be pretty straightforward. If not the DM Mega then just an Arduino would suffice - that Atmel dev kit is expensive and probably wasn't worth it...
     
  8. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    Looks like adding a new active node on BEAN (i.e. one that transmits) would be quite difficult because of the way it deals with data collision (each module delays a different amount before re-transmitting).

    However, we may want to sniff the BEAN bus to get data that the Gateway isn't forwarding to the AVC-LAN.

    Not sure - just typing outloud
     
    [email protected] likes this.
  9. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    I wonder if it might be possible to send and receive arbitrary BEAN commands through the Gateway ECU from the AVC-LAN side. That combined with BEAN sniffing capabilities might unlock access to everything on that bus. Unsurprisingly, Google's results for "BEAN sniffer" aren't too helpful.
     
  10. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
  11. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    I'm not sure how we'd figure out how to make Gateway ECU send from AVC-LAN to BEAN. In that document I link above there is a G/W address. So, maybe if we sniff for that on AVC-LAN we'll see something interesting?

    The mind boggles!
     
  12. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    Ah yes, the Flerchinger paper! I had just found that somewhere else and haven't had a chance to go through it in detail yet. Looks like good stuff, though.
     
  13. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    I'm considering a slightly different architecture for this. See attached diagram. The idea is to have a "headless" webserver and then have the head-unit be any available Tablet/Phone/Carputer interacting with the webserver via WiFi. What do you think?

    dashreplacement.png
     
    [email protected] likes this.
  14. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    I like the idea of separating the "car i/o" section from ui section and especially like the way that using a webserver makes it cross-platform. Do you suppose it would be possible to retain the original MFD and use this in parallel with it, maybe mounting a tablet over the front in such a way that it'd take over as the "main" ui but still leave the MFD running and accessible if needed? It's unclear to me to what extent the MFD is acting as a router of signals on the AVC-LAN bus, and how much of that functionality our homebrew replacement would need to replicate in its absence. Maybe there would be an advantage to turning off its display, burying it under the new screen, and just letting it continue to do what it does, adding our new interface in parallel as an additional node that snoops its traffic.

    Drawbacks I can see to this method:

    -You'd need to design the UI in HTML5 vs just using the native Android environment and a collection of (mostly) off-the-shelf apps (though I suppose it'd still be possible for it to work this way if you wanted to make the webserver handle HVAC and CAN communication only, and do the rest through native apps that don't require these things.) This could also be listed as a benefit since it ultimately means a more unified interface, just one that will potentially take more time to develop.

    -Extra cost and complexity: now you're buying and managing not just an Android device and a dumb AVC-LAN interface board, but also a Linux box and a little wifi network. I do like the FM tuner option, but would personally be willing to forgo it if I could have access to streaming radio sources along with a local library stored on the tablet.

    A lot would depend on how much custom work would be needed to create a nice HTML5 interface to live on the webserver, and I'm fairly ignorant of the options there. Did you have any particular template or tool in mind for creating it?

    I have limited free time to work on this sort of thing, so I'm very biased in favor of using off-the-shelf solutions wherever they'll work.
     
  15. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    Actually, I think I'm reverting to something similar to your original idea - using a IOIO as well as keeping the MFD. My first thought (as per thread title) was completely replacing the MFD. However, this approach would be less ambitious - but still should give us what we want (an alternative "head unit" that can control A/C as well as A/V). The MFD could be hidden if you want - I'm thinking I'll leave it as is and have the touchscreen below it in place of the radio/cassette player.

    I'll sketch a system diagram to post later.
     
    [email protected] likes this.
  16. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    OK - here's the "simplified" version.

    dashreplacement-a.png

    It may not look much simpler - but...
    1. I'm shifting more of the smarts onto the Tablet rather than having it in the SBC
    2. CAN is done via a BT dongle - off-the-shelf
    3. Leaves the MFD in place. The MFD is considered the "master" on the AVC-LAN bus and I think it's the thing that decides which audio signals to route to the amp
    4. I'll probably use one of these: Seeeduino ADK Main Board [ARD52028P] - $79.90 : Seeed Studio Bazaar, Boost ideas, extend the reach. Because I've already got one. But you might be able to use the IOIO. I might see if I can find another USB host enabled microprocessor dev board. Basically we'll be creating a functional equivalent to the Corolla MP3 project (TOYOTA Corolla MP3 Project). Instead of using an ATMega8 we'll use the processor on the IOIO (or ADK board); and instead of RS-232 we have the USB host device talking to the Android USB client.
    5. The MFD should work in parallel - just like you can use the buttons on the radio or the MFD touchscreen for controlling the radio. However, one tricky thing for me (and you if you include a radio module) is that our new device has to pretend to be both an MFD (for sending commands to the A/C) and a radio (for sending commands to the amp and receiving commands from the MFD).
    Approximate BOM:
    • Any Android device running 1.5 or higher. 10" Tablet or 3" Phone - your choice.
      • if it has Bluetooth then we'll hook up to the CAN bus
      • if it has Cellular then it can hook up to Internet directly
      • it it has WiFi then it can tether and hook up to Internet indirectly
      • cost from $75 upwards depending on what you choose
    • Either an ADK board or any other microprocessor with USB host capabilities and available GPIOs
      • Seeeduino ADK board is $70
      • Arduino + USB host shield is approx $80
      • IOIO is approx $50 - however, I'm not sure what processor it uses and whether we can execute our own code (because I kind of doubt the AVC-LAN protocol is already implemented in the Java libraries!)
      • We'll be using this board as the sniffer initially to discover what commands to send (I wonder if we could create something akin to training a universal I/R remote?)
    • FM Radio module
    • Bluetooth Dongle
      • Something ELM327 based will be compatible with Torque
      • I purchased mine from Deal Extreme.
        Bluetooth OBD - Free Shipping - DX
        There are three that look like mine with 3 different prices. (between $20 and $40). I probably chose the cheapest! It works...
    • AVC-LAN driver hardware

    Excluding the Android device: $70 (ADK) + $30 (FM) + $20 (BT/CAN) = $120.

    I actually have all the bits apart from the FM module - so my BOM is $20 (oh and a couple of pennies for the 4 resistors!) Ever so slightly less expensive than YaPIP...
     
    [email protected] likes this.
  17. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    Additions to the BOM:
    • I've not included anything about mounting. That's left as an exercise for the reader ;-)
      • My current thought is to go with a 7" tablet mounted where the radio/cassette head unit was and leave the MFD in place.
      • If I get that working well I may "upgrade" later to hide the MFD and use a bigger display.
    • Because I like knobs I'm thinking of a single rotary encoder that can be dynamically assigned to multiple controls (a bit like BMW iDrive - except I've never ever played with one of those). I'll probably go with something like this initially: Rotary Encoder - Illuminated (RGB) - SparkFun Electronics ($5 including the knob). If it works well and I want a more "analog" feel then I'll likely go with one of the more hi-res units (this one outputs 24 pulses per revolution)
     
    [email protected] likes this.
  18. contraption

    contraption New Member

    Joined:
    Sep 26, 2012
    12
    1
    0
    Vehicle:
    2008 Prius
    Model:
    Two
    Ok, now I'm starting to feel bad. I'm just sitting around idly speculating about what I might want to eventually do, and here you've taken time away from your other project and gotten the plans all drawn up!

    But wouldn't it be nice if it were!

    I looked into that a little and found that bit banging is still on their "to do" list, so something that allows lower-level access to the comm lines would be nice. I suggested it initially because it happened to be the Android->physical i/o device I'd heard about, but the Seeed Studio piece looks it might be better suited to this task (I have one of their "mp3 player" oscilloscopes, really cool little device.) I'll pick one up (or something else Arduino-based) for ease of code sharing.

    Unless I'm missing something, the BOM will also need to include some parts to talk to the AVC LAN (note that the 4-resistor sniffer design is a receive-only situation, he's using a PCA82C250 to handle transmission and a LM239 to receive in the final circuit.)

    [EDIT]Oh hey, just noticed you addressed this somewhat in your description, with a link to a clearer image of the schematic to boot. Yeah, I don't believe the 4-resistor "sniffer" circuit is meant to be bidirectional, so we'll be stuck with those two extra chips.
     
  19. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    I'm not so sure the 4 resistor version won't transmit because I seem to remember seeing references to send commands in the source code... We'll see...

    EDIT: The software associated with the simplified 4 resistor version certainly implements send as well as receive. It very well may work...
     
  20. jdh2550

    jdh2550 Co-Founder, Current Motor Company

    Joined:
    Nov 16, 2010
    317
    249
    0
    Location:
    Ann Arbor
    Vehicle:
    2005 Prius
    Model:
    N/A
    contraption - I just ordered one of these: Open Logic Sniffer seems like a bargain compared to the Saelae Logic. What DSO do you have? The Nano V2? Do you find having only one channel is a problem or not?