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

CAN controller/monitor for the Gen II Prius

Discussion in 'Gen 2 Prius Accessories & Modifications' started by FirstFlight, Aug 19, 2012.

  1. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    I've read through a handful of threads where some guys are making devices/writing software to interface with the CAN. Last month I figured I'd give it a try too. For me, understanding the CAN specifics and decoding the messages has been difficult but fun. Anyone who says that they understood the CAN network protocol and decoded the CAN messages for the Prius easily is smarter than I am. Nevertheless, I pushed through, sometimes staying up until 2 or 3am trying to get everything working. I guess part of my problem was writing the USB code too but life isn't easy either.

    I'm not sure what the end product will be. I don't even know what this thing is fully capable of but the past few days of testing have been really interesting. I've attached a screenshot and as you can see the layout is still in its infancy. I seem to change it daily to improve the look. Using visual gauges seems like a great approach because a quick scan of the screen will reveal something awry. I'm also including numerical values for more in depth investigating. My traction/braking gauge will turn green when in traction and red when in braking and I'm planning to change all of the gauges to include color changes. For example, if the battery temperature increases past 105 degrees, it will turn from blue to red so when the screen is viewed, it will catch your eye.

    I had three interfaces but canned one. The graphical LCD screen didn't seem like it was worthwhile so I stopped writing the code for it. I currently am writing the code for a 4X20 LCD screen and a USB 2.0 VB program that interfaces with the microcontroller. I can get about 30 readings a second but when I datalog the information it's more like 5 times a second. I'm still working on that to get it to a point where I'm comfortable with it. CAN controller.JPG

    So many ideas have come from my experimenting but what I'm interested in is what you (the person reading this post) are interested in. My end goal is to sell a functional product so if you could design this tool the way you wanted to, what would you be most interested in? I'm pretty sure I can read just about any CAN message and controlling some things shouldn't be a problem either. I'm probably about 40% through what my original intention was when I first started so I'll know a lot more over the next couple of weeks.

    I could also make simple devices with no visual aids. My mind is still churning but these things are certainly within my capability: A plug-n-play HV battery fan controller or plug-n-play EV mode controller/feed back module are just two of the things I'm looking to produce. Maybe even a plug-n-play engine temperature spoofer and all of these for a low cost. Even the USB version with data logging should be around $100.

    Again, if you wanted to buy a CAN controller/monitor for your Prius, what would you want on it?
     
    NortTexSalv04Prius likes this.
  2. John H

    John H Senior Member

    Joined:
    Jun 4, 2012
    2,208
    558
    0
    Vehicle:
    2007 Prius
    Model:
    N/A
    If it would add 5mpg, or more, I would be interested.

    I am concerned about adding any visual distractions, like a traction/friction braking indicator. Audio cues might be a better or alternate approach.

    I would want to know when something is operating out of norm rather than visually monitoring it constantly. for example. I usually burn .78 gallon on a daily morning drive to the office, if that varies by more than 5% I would like an alert so that I can check tire pressures, fuel quality, etc .... another example, I descend down a slight grade for 6 miles on a regular route, is the amount of regenerated energy stored into the HV battery within a couple % each time or has something degraded? Can I trend these monitors over months and seasons (my local gas blends are seasonally adjusted for air quality)?
     
  3. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,705
    510
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    Good idea to use color to signal events - most gauges in my PriiDash program change color when the value cross some threshold, so the user is alerted when something overheats, fuel is low, or engine switches on/off.

    Where do you get the engine oil temperature?

    Wish list:
    1. Ability to send CAN requests while monitoring all CAN traffic. Currently I use two ELM compatible devices via a Y-cable - one does the requests and the other ATMA. Since you are custom building the electronics you should be able to shrink that down to one single device easily.
    2. Ability to communicate on CAN and KWP simultaneously. The ELM device is limited to one protocol at a time. The hope is that with your device the limitation can be lifted. I also have problem talking to most of the ECUs on the KWP bus using ELM. Hopefully your device will work better.
    3. ELM compatible command set (with some extension of course) - just to make it a bit easier to adapt to already written program.

    Thanks!
     
  4. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    This wasn't intended to improve MPG's, although I can't rule it out. My original intent was for this device to be more of a troubleshooting device. Having "something" improve your MPG's by 5 MPG is difficult to achieve. I've found that driver habit is the biggest contributor to low MPG's on a daily basis. Without trying, I can get 52 MPG. If I really concentrate on all of the little things, I can get 59 MPG on the same route to work.
    Agreed. The laptop wasn't really used to be a driving screen and before the user enters it they must acknowledge a pop-up screen with a disclaimer on it.
    I'm not sure how to achieve this. IMO, you would need to start at the same SOC, same battery temp, same environmental conditions, etc. each day you descend down the hill. As an example, you'll regen more with a lower SOC and normal battery temp then you would with a battery that is 105 degrees and an SOC at 72%.
    You can log data and as of now only the laptop can be used to do that. I'm thinking about including an SD card or using the internal memory of the processor but I haven't looked at the write speed of either, which may slow it down, but the issue here is that adding stuff like this isn't like going to the store to buy a gallon of milk. It's going to take some time to see if adding these features are worth it.
    I haven't looked at that signal yet. The gauge is just sitting idle on the screen for now until I get to it.

    Done. In the snapshot below, I've added virtual buttons to do just that. You just simply enter your CAN data packet to the right of the TX label, the press the "PGM" (program - circled in red) button and then press the "SD" (send data - circled in black) button. The data will come back in the RX field or be routed directly to one of the virtual gauges, if the gauge is on the screen. There's a lot of "behind the scenes" tasks that are being done but if the user wants something specific, they can enter the appropriate code and request it. I may make this a one-step process in the future but that's how it works for now.

    I want to make a database so the user won't need to enter the CAN code, they'll just have to know what they want. I'll probably leave that feature there in end because I'm sure they'll be things a user wants to see that I wouldn't have thought about during the design process.
    I don't know anything about the KWP. Can you send me or point me to some information on it? I can take a look to see if this can be incorporated in my design.
    Not sure what you mean? Do you want my device to talk to the ELM?

    I've added the battery block voltages and resistance readings, along with shifter position and some other small items. Still plugging away to make this a very user friendly tool with a lot of features. My ultimate goal is to make this somewhat of a tech stream tool that doesn't cost thousands of dollars. I'm still looking at a price point of under $100. The automatic fan controller works awesome and I will sell that as a plug-and-play unit for a lower price if someone doesn't want/need this program below. My battery temp never gets above 100 and I don't have to do anything to maintain that temperature. It will also warm up the battery automatically when it's cold as well.



    CAN CONTROLLER - 8-27-12.JPG
     
    [email protected] likes this.
  5. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,705
    510
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    Yes it would be great to have a low cost alternative to Tech Stream.

    To read non-standard DTCs we need to be able to communicate on the KWP bus. You can google "KWP 2000 protocol" and read up on the standards. But Toyota does not follow the standard - that's why I am having trouble using an ELM device. So far I could only talk to the skid control ECU but not others. See this thread for more details:
    CANBUS PIDs | Page 3 | PriusChat
    The Berkeley document collected many communication details on the KWP and CAN bus:
    http://sprg.ssl.berkeley.edu/sprite/hdh/_hdh_dwgs/Drawing_File/0199-ME02-K.xls

    Regarding wish list #3 I was thinking to interface your device with my program so I can have control of the look of the UI. I think as long as your device presents itself as a virtual COM port we can make it work. Thanks!
     
  6. John H

    John H Senior Member

    Joined:
    Jun 4, 2012
    2,208
    558
    0
    Vehicle:
    2007 Prius
    Model:
    N/A
    I see a few threads where long time Prius owners/drivers are observing lower mpg and having trouble identifying the contributors. It seems to me there is value in a device that performs long term observation of the vehicle's operation and alarms/alerts when something deviates from the learned normal. Trip mpg is one point of reference but there are many others, like battery temperatures and SOC.

    It seems to me that a device could observe the total KW (gasoline and battery) used for a specific trip, and perhaps even segments of that same trip, and then compare those observations over time and trend them. GPS information would aid in accuracy and automation rather than requiring a start/stop interaction but recognizing a common trip could be accomplished without a GPS with just a comparison of trip distance, maybe confirmed with another observation like hard stops at the same trip distances. Hard stops might be the easiest segment boundaries.

    Maybe PriiDash does some of this, but I found it too cumbersome to install and the screen too busy. I found Torque to be useful and I have used CarChip as well.
     
  7. vertex

    vertex Active Member

    Joined:
    Mar 27, 2009
    670
    143
    0
    Location:
    new york
    Vehicle:
    2018 Prius Prime
    Model:
    Prime Plus
    Give us an OBDII tool that reads the inf codes as well, and can clear codes and send the commands to bleed the brakes etc. as the TEchstream does (someone else said something like this). Otherwise you are reinventing the wheel. See Atilla Vass' work.
     
  8. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    I'll give it my best shot but I would probably need the Techstream to accomplish that.
    Coke and Pepsi exist. Toyota and Honda exist. McDonalds and Burger King exist. Each one has something different to offer.
     
  9. 2009Prius

    2009Prius A Wimpy DIYer

    Joined:
    Mar 25, 2009
    2,705
    510
    63
    Location:
    USA
    Vehicle:
    2009 Prius
    Don't forget iOS and Android. :)
     
  10. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    Did you want the Jacuzzi in the roof of the car or in the back seat?:D

    I'm a novice programmer (I'm much better with hardware/designing circuit boards) so some things are a little harder than others. I actually started doing an iPad app, which I know will work, but the hardware that you need to connect to the iPad is slower and it's costly. I'm thinking about doing this with WiFi because pretty much every device has it nowadays. Being a single dad and having my kids full time, it's hard to find time to keep things moving but I take a couple of hours every night to make some progress.

    I like what I have right now and I will post a YouTube video tomorrow so you can see how it works. I'm not a car guy and I doubt I have all of the signals that people would want to view. In my post tomorrow I'll ask you guys what else you would like included, how you want things arranged on the screen, what kind of buttons/interfaces you would want.

    As far as the KWP, I've looked into it briefly but I need more time. Can you buy that ELM device as just an IC? If so, worst case scenario is that I put the IC on my circuit board. When I get more time I will look into it with a lot of detail and hopefully I can get it working. Regarding the Techstream (reading inf files/bleeding the brakes), it's a long shot but I'll try my best.

    I don't think this is reinventing the wheel here. I can design an interface for each specific person. For the person who wants a plug-and-play device that is customized to what they want, this will work for them, especially if they don't know any programming languages. I'm trying to make this as cheap as possible and since most people have a laptop, I figured this would be the best approach but as it stands now, these are the GUI interfaces I'm attempting to have it compatible with:

    1. Laptop -Done
    2. 4x40 OLED screen -Done (Next weekend I will mount this in my car so you can see what it looks like installed)
    3. 4x40 LCD screen - Done
    4. iPad - I'm able to communicate but it will take a lot more time before this is completed.
    5. Android/iPod - haven't attempted it yet.
     
    [email protected] likes this.
  11. John H

    John H Senior Member

    Joined:
    Jun 4, 2012
    2,208
    558
    0
    Vehicle:
    2007 Prius
    Model:
    N/A
  12. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    That's perfect! Thanks for the link. The IC's are little pricey but as a worst case scenario it's not a bad option. I will definitely include the KWP in my device.
     
  13. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    2009Prius - Which IC do you use? Only one IC mentions KWP specifically.
     
  14. John H

    John H Senior Member

    Joined:
    Jun 4, 2012
    2,208
    558
    0
    Vehicle:
    2007 Prius
    Model:
    N/A
    I will suggest putting wifi onto the device, with a embedded web server and an html5 gui. That would get you ios, android, and windows mobile covered as well as laptops. It would also allow connectivity to your home wifi network when the vehicle is parked in the garage.
     
  15. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    I can communicate without wires now and see the data on the internet but it's a LOS 2-way system that is hosted by an embedded web server - Definitely not something that is user friendly.

    Regarding Wifi, yes, it would be able to connect but the issue is writing the GUI's for all of the devices. That would mean all of the USB work I've done up to this point is wasted. I will get to that point but I want to have a fully working/user friendly product first and then I can add the WiFi feature when I have time. I'll make the circuit board so that the end product won't have to be a redesign but rather just drop the WiFi module in, reprogram the IC and it's done.
     
  16. John H

    John H Senior Member

    Joined:
    Jun 4, 2012
    2,208
    558
    0
    Vehicle:
    2007 Prius
    Model:
    N/A
    A single html5 gui for all the clients, and an xml/soap interface for m2m clients. How have you implemented all the USB work to date? a simple 2 way serial stream? should be able to just put the soap interface on top of the serial i/o.
     
  17. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    Yes, all of the USB 2.0 work is completed. I'm just adding variables, colors, gauges, etc. and making sure my math is correct for each new variable. This is what's slowing me down. Getting time inside the Prius to verify the signals can be difficult.
     
  18. John H

    John H Senior Member

    Joined:
    Jun 4, 2012
    2,208
    558
    0
    Vehicle:
    2007 Prius
    Model:
    N/A
  19. nh7o

    nh7o Off grid since 1980

    Joined:
    Dec 10, 2011
    1,686
    339
    0
    Location:
    Hawaii
    Vehicle:
    2009 Prius
    Model:
    II
    A search for "mini vci" on eBay will provide this, for $30. I know there are a wide range of opinions about this sort of thing, some more or less passionate. I salute those programmers who have the skills to do what is being discussed here, and would love to see an alternative. But it's a looong road I think.

    This is why I added my two cents worth with Priidash_Lite. I extracted those gauges I wanted to see (temperatures, mainly) and eliminated those which merely duplicated info that was already on the car's MFD or dash. This is easy with the Fluid design tool. One can expand those gauges that are most interesting.

    I would again question why would one put data on a screen that is already displayed by the car conveniently, such as the state of the transmission control (P-D-R-N-B).
     
  20. FirstFlight

    FirstFlight Member

    Joined:
    Oct 9, 2010
    429
    77
    0
    Location:
    New Jersey
    Vehicle:
    2005 Prius
    Model:
    N/A
    I don't know much about the Techstream but does the Techstream do that the mini vci cannot?