Mac Prius (last updated 09/09/2006 - Working on a new visualization for prius CAN data including the PSD)
The quest to make Mac Prius. A work in progress! Webpage in progress too!
(For the impatient - scroll all the way down for a QuickTime video of Front Row being controlled by the Prius's MFD touch screen)
The first thing I needed was video in. There are a number of options here, I decided to go with the CAN-view for a number of reasons, it takes RGB in opposed to other options that are either only composite video or s-video. Also the CAN-view has a serial out which I had hoped to be able to use to read touch screen coordinates, and maybe eventually take the other CAN data to build an interface showing different car statistics. At the very least even if I couldn't get the Mac Prius working I'd at least have the CAN-view interface to look at and play around with. I highly recommend this product. I am very impressed with Norm the designer of the hardware and software. He makes a great product, and is very helpful in emails and is always willing to help out. I can't say enough about Norm. Even if you aren't interested in the Mac Prius but you want to see the inner workings of the Prius I would highly recommend the CAN-view. I have the version that works with the NAV enabled Prius and it hooked up right to the NAV player under the driver's seat. Only took me 15 minutes to hook it up. It was easier then getting the Coastaletech EV Mode Kit hooked up (which wasn't hard either). The non-NAV version looks to be a bit harder to install because you have to take apart the dash to get behind the MFD. Anyway, check out his site! Hybrid Interfaces.CA
Next I had to figure out how to get the video from the computer into RGB+Sync in a resolution and refresh rate the Prius's MFD could accept. That is NTSC timings of 15.75Khz at 640x480. This has proved to be the most time consuming and expensive part of the project (trying different things) I first bought an Extron RGB 109xi VGA-QXGA from eBay. Not really doing any research (I saw someone post about it on a car computer forum) I thought it would take my VGA out and convert it to RGB+Sync at the refresh rate I needed. Well it turned out that it would convert VGA to RGB+Sync, but it wouldn't change the refresh rate. So next I started looking for solutions to get the video card to spit out what I needed. The first thing I found was a program for Windows called PowerStrip. With PowerStrip I was able to get my IBM Thinkpad to output 640x480 at NTSC timings. Here are the results, Success!!
Windows First attempt (PowerStrip)
Windows with Flash
The photos actually make it look a bit better then it looked in person. It was very flickery. Darn flash brings out all the fingerprints and dust!
So I got it working with a PC, but this is supposed to be a Mac Prius. My next goal was to make it work with a Mac. I have an iMac at home, and older Titanium Powerbook. My Powerbook was going to be my prototype. I found a program called SwitchResX which is kind of like PowerStrip for the PC but not quite as powerful. I tried my best but I could not get it to accept refresh rate that the MFD needed. I eventually gave up and the project sat around for awhile.
I started looking around and found that Extron did make a product that did what I need. A scan converter. Professional scan converters are expensive. I didn't want a cheap home use one that only outputted composite or s-video, only professional one output RGB+S. Searching on Ebay I found some older ones from Extron and other companies going for $30-$200. I settled on the Extron Emotia II. The first one I ordered didn't have a power supply. I thought I could figure it out, but I ended up frying the thing (power goes into a 5 pin DIN connector, all Extron said it required 12 volts at 2 amps). Went back to eBay and won another one for even cheaper that actually had the power supply and cables with it. Turns out one pin is +12V, one pin is -12V, one pin is +5V, and there are 2 ground pins. Anyway it worked great! I was actually pretty impressed with the picture.
Finally working on my Mac!
Flash so you can see it's really in a Prius!
Top, pretty good resolution, you can actually read the text
Now that I had my Mac working on the display it was time for the fun stuff. I decided that I wanted to use Apple's Front Row as my main interface. My first two primary goals were to have my music collection, and be able to play DVD's for my daughter on long trips. I figured Front Row was the perfect application for a relatively low-resolution display. First I had to figure out how to get it to run on my Power Book (and later on a Mac Mini) since Apple only makes it natively available on the new iMacs and MacBooks, here is a page describing how to do so Andrew Escobar.com.
But how to control Front Row? Normally Apple supplies a small remote control. It's a very simple device. It just has up, down, left, right, play/pause, menu. 6 buttons. I also found an AirClick hack, which is a 3rd party remote control people, have gotten to work to control Front Row. I was able to use that to find the Apple Script commands to control Front Row.
Next I had to figure out how to read the touch screen. As I said earlier the CAN-View will send touch screen coordinates out the serial port. Basically it sends out 1 byte. The first nibble is the X coordinate; the second nibble is the Y coordinate. So for example F9 would by x=16, Y=9. Only a 16x16 grid (a parity byte will get you 32x16), which is quite sufficient for the small touch screen.
I wrote a perl script to listen to the serial port (using a Keyspan USB->serial converter), which then sends the Apple Script commands. I've used the following perl modules found on CPAN.
Download priusFrontRow.pl (version: 2006.02.18,01)
Download canview.pl (version: 2006.09.27,01) Sets up socket to send CAN data through XML to external programs. This is currently being developed daily
Download PSD_drive.as (not the most current version) ActionScript code for the Flash interface.
This script will need tweaking to work on your own system. If your Mac spontaneously combusts after running this scrip I am not responsible!
Playing a song
To emulate the Front Row remote control I decided to split the screen up into a 3x3 grid. Top middle is up, bottom middle is down, left center is left, right center is right, center is play/pause/enter. Upper left corner is esc. Unfortunately the touch screen only gives the coordinates when you release your finger, so no touch and hold to scroll down menus. I decided to take the upper left box and lower right box to be up and down but stay scrolling until you touch it or any other portion of the screen again.
Below is QuickTime video of the results I have so far.
Quicktime Movie demoing Front Row with a touch screen interface!
Next is figuring out the audio portion. I've seen a few AuxIn cables to hook into the radio. I have the radio with the CD changer and I understand that I may loose the CD changer with some of the options on the market now. If anyone has some thoughts drop me a line! (jeremy >at< kusnetz.net)
Once I have that working it will be time to actually get my Mac Mini and get everything hooked into the car like it belongs there. I've found the CarNetix CNX-P1900 PSU to use to power the mini and have it sleep when I turn off the car. I'm not sure what I'm going to do with the Extron (using an inverter now). I may end up getting another scan-converter that is simpler to power then having to deal with 3 different voltages.
02/21/2006 Possible Audio solution. Here is a thread I posted on mp3car.
Basically I'm thinking of sending the Mac's audio directly into the JBL amp via a relay which is driven off of the CAN-view.
Here is some info Norm gave me:
Well, when you switch to video input 1, a +3.3 volt signal is applied to my U10 multiplexer chip on pins 5,6,12 and 13. All other times its zero.
So the signal already exists, we just need to make it strong enough to drive that relay and find a way to get it to that relay. The signal itself is not enough to drive even the smallest relay directly , but use it via a 2k resistor to the base of a common transistor (2N3906) and the collector would then happily drive that relay. If it doesn't already have one, the relay needs a protection diode across it to stop the back-emf damaging the transistor. Cheap 1N4148 would do. I would suggest that you use the same 'spare' pins on the external video SCART connector that I used for the prototype CAN-view relay boards.
SCART J4 pin 2 say. (although pins 6,8,10,12,16,20 are also free) Is this enough to go on or do you need more?
I think this should be a fairly easy project to complete. See my post on mp3car for details on what I'm planning on doing. I hope someone has some good tips for me there. If anyone reading this here has good tips let me know!
02/22/2006 I've ordered some parts and have the circuit figured out.
I ordered a DIGIKEY Z186-ND RELAY PWR 3A 4PDT 12VDC which has a coil resistance of 160Ω
I also ordered an PIE LD1 2-Channel adjustable Line Driver. I'm not sure if I'll need it, and I probably jumped the gun but hopefully it will come in handy.
Here is the circuit I'm planning on using: relaydrv.pdf (NPN driver)
Details from Norm:
The relay is 160 ohms so on 14 volts with the car running, thats I=V/R = 14/160 or ~88mA maximum The 2N3906 transistor can handle 200mA at 40v so no problem. With a minimum current gain at 88ma of 60 that means the 2N3906 needs a minimum of 1.5mA base current to turn it on. The 3.3 volt signal you will use, less the base emitter drop of ~0.6 volts means there will be ~2.7 volts across the base resistor so to get 1.5mA you need a 1.8K resistor worst case. But in reality, practically anything between 1.2K and 2.2K will probably work fine. cheap 1/4W 5% carbon film, is adequate.
Just real quick, I finally got all my parts, and I got the relay driving off of the CAN-view. We had to change some things around, and Norm actually had to put out new code. I am using a 2N3904 transistor with the collector on pin 1 of the J6 SCART cable, the emitter is on pin 5 (ground), and the base is connected through a 2.2Kohm resistor which connects to pin 3 of the programmer head. Norm had to add code to have pin 3 activate the transistor when you view the video input of the MAC.
It's not perfect yet because I suck at soldering and it was a bitch fitting all the new cables under the passenger seat. Tore up my hand pretty good! I'll work on it more tomorrow and give better details once it's all working correctly.
I know what computer I'm going to use, the new Intel Mac Mini! I can run Front Row legit! I'm leaving to go on vacation on Friday, so I'm not going to order it until I get back. The project will be on hold for a week too.
Well I didn't get a chance to do much since the last post (getting ready for the trip). When I get back on the 13th I'll be able to continue. Audio is >this< close to working, I just need to clean up my cold solder joints. I'll also probably order my mini when I get back. I have a question out to the guys who make the DC powersupply for the mini to see if it will work with the intel version. They haven't gotten their hands on one yet, so I'm hoping it will work. I do know the powersupply that comes with the intel mini is 110 watts compaired to the G4 mini with a 85 watt supply.
Just real quick. I got my Intel Mac Mini yesterday. I just ordered the Solo Core, with the standard configs that it comes with. I may add more memory at a later time, but for now I think it's fine for it's use in the car. Most of the audio wires have been re-soldered with a MUCH better connection (Thanks Ed!), there are still a couple of more wires to solder. I'll post picture of the relay and wiring harness when done.
So I'm hopeful that I will have the Mini running in my car with audio by this weekend. Once I verify everthing is looking good will be getting Mini and all the rest of the parts mounted cleanly in the car.
Well thanks to Ed again we got everything soldered up nicely. I hooked the jumble of wires back into the amp, and everything works perfectly! I haven't hooked up the mini yet, but I did test things out with my ipod and it sounded great! Today on the way to work was the first time I could listen to my music without the annoying interference from my FM transmiter. The Aux directly into the amp was a really good idea. It may not have been the most simple option, but being able to control it directly from the CAN-view is perfect. I'll get pictures and a more detailed description posted later. One thing I did notice is the version 3 of the CAN-view (I have version 2) now has the changes Norm and I worked on built in, so no soldering required on the board. If you have a version 2, you can do what I did.
Now to get the mini hooked up. I spent some time configuring it at home. One thing I'm missing is a keyboard and mouse to use with it in the car. I could use Apple's bluetooth keyboard and mouse, but it's kind of bulky for car use. I was originally going to go with the Think Outside - Stowaway Universal Bluetooth Keyboard (you can get it for $100 from Amazon), but I would still need a pointing device. Remeber the touch screen on the Prius is very low resolution and is not a replacement for a mouse. Think Outside also makes a bluetooth mouse, but I don't think a mouse is the best option for using in the car. I think a trackball would work better. It's hard to find a bluetooth trackball. I've found a total of one. The Ball by Chwang Yi. I'm not sure what I think of this one, it would probably work just fine. I did find one more option. A bluetooth keyboard with trackball built in, the iNPACE Bluetooth Wireless Keyboard. I think I like this option, although it's much bigger then the Think Outside keyboard. It looks like it will come to about 13"x5"x1". If that will fit in the arm rest console that would work out well. What do you think? Has anyone seen any options that would work better? Drop me a line!
Yes it really is all working. Today I had about 2 hours of driving, and I was finally able to see my vision come through, I was able to listen to my music (and my daughtor's music) all controlled through Front Row on my new Mini.
All is not perfect though, and there was one serious problem that I haven't resolved yet, serious enough to where I think I damaged my new Mini.
Yesterday I had audio working great with my iPod, sound was perfect. Last night I tried hooking up my mini to the car for the first time and I was greated with a loud pop and squeel, shortly followed by electronic burning smell and a bit of smoke. I shut things off right away. Everything in the car was still working as expected. I brought the Mini back in and found it still smelled of burnt electronics. It works fine, but I hooked up some headphones and noticed the sound wasn't right. I can't quite put my finger on it, but it seems some frequencies are distorted. It's not bad, but it's noticable.
This morning I did some digging and I found that if I bypassed my inline amp I'm using to bring the audio signal up to the same strength as the head unit, then things worked fine as I expected it to do. With the Mini's audio cranked all the way up, I still have to turn the radio 10-20 settings higher to get the same volume as I do with the head unit. I listen to the radio at about 15-25 depending on speed. I need to set it to 35-45 without the preamp. This makes for a nice blast when going back to normal radio if I forget to turn down the volume.
I'd really like to figure out why the preamp is doing this. It works fine with the iPod. I did notice about 6.5 volts coming off the tip of the phono jack. I mentioned this to norm and he wants me to run that through a resister to see if it's true driving amps. I have no idea what would cause this. I think the reason it works fine with the iPod but not the Mini is the Mini is grounded and the iPod is not. If you have any thoughts or suggestions, PLEASE let me know! jeremy at kusnetz dot net.
So besides having the turn the volume up, and possible doing something bad to the Mini (okay that's really big!), things are working great! The touch screen worked perfectly while driving, it was wonderful to have my library of music available to me!
The the pre-amp situation seems to have cleared itself. I was going to do some more debugging, but the 6.5 volts are no longer there, and the sounds is pretty good! Per Norm, he thinks it sounds like I may have had a poor ground on the pre-amp so it was sending it's ground they only place it could, through the Mini. It's possible I fixed the ground. I am going to run a 100uF electrolitic capacitor in series with the audio (per Norm) just in case the problem rears it's ugly head again.
Right now I have the Mini stuffed in the center console. I was worried about heat, but so far I haven't noticed anythign getting hot in there.
I've gone ahead and ordered Think Outside's bluetooth keyboard and mouse. I've decided that the center arm rest makes a perfect mouse pad.
It's been awhile since posting, but work has been coming along. I'm now working on mounting everything. I took my dash apart (instructions) to get to the map holder under the radio, this is where I want to mount my mini. The mini fits suprisingly well there, it almost doesn't need any kind of mounting bracket, it sits there rather well. I am working on making a bracket though. I picked up some aluminium stock at Home Depot and am making an attempt. I don't have the right tools, and I've never done this before, so it's coming along slowly. I'm debating about if I want to make the mini easily removeable. If I do, I will need to trim some plastic from the black cover with the transparent door on it - the mini is about 1/8 inch taller then the opening. I wanted to avoid any desctruction of the car if possible.
I've also started configuring and installed my CarNetix CNX-P1900 PSU, it seems to fit perfectly behind that tan plastic piece below the stereo. I still need to order the mini power cable so I can make it make the mini sleep when the car shuts off. Right now it seems to just power the mini down after about 1 1/2 minutes after I shut things down, but at least the mini is being powered right off of a DC/DC powersupply now.
I've also decided to try a different scan converter, getting the negative volts is going to be difficult without buying another power supply. I bought some chips to turn +12v into -12v, but after I bought the chips I realized the the CNXP1900 doesn't supply enough amps through it's secondary output to power the extron. I've gone ahead an won a bid on ebay for a Scan Do Pro. It takes a single +5v input (so I read), so it should be much easier to power. If it works I guess I'll be ebaying my extron.
Well I finally got my Scan Do Pro 1271 scan converter. Took about 2 weeks to get it. The main reason I got it was because it was going to be much easier to power (just a single 5v input). I got it and it's huge! It actually has a smaller foot print then the extron, but it's much taller. I decided to take it apart and basically just mount the mother board. It also did not come with it's special DB15 to HD15 cable. I found I could order one for $30, but I also found a pinout diagram that I used to build the cable myself. Amazingly enough the cable worked the first time.
The bad news is I think the picture quality is worse then the extron. I was really surprised because it's a much newer hardware then the extron (still 10 years old though). It has a couple of anti flicker settings which help a bit, but there is still a lot of flicker in the picture. I think a lot of the flicker is a grounding issue (extron had the same thing but not as bad, and when I plugged the extron in via an extention cord it went away). Kind of like ground loop buzzing sound in audio, I thought the flickering was a ground loop issue in the video. I decided to change how the powersupply was grounded, I'm actually now grounding the powersupply right into the same cable that came with the CAN-view, so now the CAN-view, powersupply and thus the mini and scan converter should all be sharing the same ground. No change in the flicker.
Anyone have any ideas? jeremy at kusnetz.net
So next weekend I'm flying out to CA to attend the Make Magazine faire. One of the guys from CalCars found my sight and invited me out. Just so happens there is a conference I was planning on going to from work that same week, so timing worked out great! Sorry, I won't have my Prius there.
Last weekend I flew to San Mateo in California to attend the Make Fair. The guys from Cal-Cars were there and it was really cool to watch them to a PHEV conversion. Make the Mac-Prius thing look simple. Maybe that will be my next Prius modification. So needless to say I didn't get much done last week, although I did visit Fry's Electronics and bought some electronic parts that are more difficult to find out here in Northern VA. How can I get Fry's to open a store out here? It's a geek's heaven.
Today I did some wiring clean up. I really should have taken some pictures, but I'll describe what I did. Up until today I've had wires running out of my dash down the center of my car and out behind the two front seats. Plus there were wires running between the seats towards the back side so passengers sitting in the back could step on wires and pull them out. So today I decided to try to get wires running under the carpet and under the center console into the seats. The first thing to figure out was how to remove the center console. Turned out to be pretty easy. First I pulled out that hidden draw on the middle bottom. Just squeeze the sides and it will pop out. Then you can give the silver plast which hold the 2 front cup holder a good pull and it will snap right off. This will expose two screws on both the left and right side. Just remove those. Then take the plastic back where the back cup holders are and give it a pull and it will snap right off. There are two wire harneses there, just unsnap them. Then open up the top of the center console, remove the felt on the bottom and this will expose to bolts. Use a 10mm socket to remove them. You can now lift the center console right out. I then just passed the wires that go between seats (relay ground wires, scan converter RGBS BNC cable) across the center island (the console will just sit on top of them now). The harder part was to get the wires from the Mac (VGA cable, power to scan converter, USB cable, audio cable) under the carpet and into where the center console sits. I was able to pull the carpet on the passenger side out enough to where I could pass the cables under it and into where the carpet has a whole in that center island under where the console is (yes pictures would have helped here). It's really not hard, though the VGA cable was a tight fit under the carpet. Once I got the cable passed under the carpet I was able to put the center console back. I now have no exposed wires at all!
My last step is to just finish figuring out how I'm going to secure the Mac in it's space under the radio. But once I get that done, I think I'm pretty much done!
I installed the Mini. I took the easy route and did not create any kind of dock. Instead I just cut out a a piece of foam about the size of the top of the mini and wedged it on top of the mini when it's sitting in the space that used to hold the map holder. Seems to keep it pretty secure in there. I also added an external button to the power button wires the P1900 power supply uses to put the mini to sleep. This way I can power up and down the mini at will without having to reach behind the mini to push the button.
Of course nothing goes perfectly and I'm going to have to pull the mini out later. I need to check the audio connection, I'm now occationally hearing a loud squeel when I turn up the volume on the Prius. I think it's probably the the little connector I made with the electrolitic cap. I attached to make sure no stray voltages enter the Mac, it's kind of squished in the back of the Mini now. An other anoyance is I stuck in a DVD and for some reason the Mini won't recognize that it's in there, and I can't seem to eject it. I'm relying on a bluetooth mouse and keyboard, and the usual steps to force eject a DVD (hold down the mouse button when rebooting, or hit command-option-o-f when booting don't seem to work with a bluetooth mouse and keyboard) I now need to get a USB mouse hooked up. Maybe I'll get a cheap USB mouse hooked up and try hiding it in that center column where the P1900 is, that way if I need to use it I won't have to take the entire dash apart again to get the Mini out. Arg...
I took more pictures of the setup, I'll be posting them soon. I also took a new movie. Too bad I couldn't show off playing DVDs.
Haven't posted here in awhile, but the site has gotten renewed interest in the past couple of days. All the problems above have been worked out. The loud squeal was from the wiring harnes going into the JBL amp being loose. The stuck DVD was from how I installed the foam squares to friction fit the mini. The foam on top was actually pressing into the top of the mini and screwing up the DVD drive. I put more of the foam on the bottom of the mini and this fixed the problem, DVDs work great now.
I just bought a sub-woofer to install the Kenwood KSC-SW1. That will be going in this weekend. Here is someone who has installed it into their Prius: Pirus Ownersgroup. My next project is to take the other CAN data coming in through the serial cable and build an interface to display that instead of using the CAN-view's interface.
I also wanted to post some sites that I've used for information on this project:
In addition to being posted on Digg and many other Mac and Prius/Car blogs, I made it to July's issue of MacWorld (pg 79)
So a couple of weeks ago a Prius Chat member Ichabod posted a Flash program demoing the Prius's PSD. I thought it would be really cool to feed that program live data from the CAN-view to visualize the PSD realtime. So after doing a learning crunch on Flash and in particular ActionScripting I figured out how to pass data from my perl program to the Flash. See above for the new perl code. Ichabod is still working on his code but I think when he is finished he will feel comfortable releasing it to the public. In the mean time I put my little bit of ActionScript that allows the Flash program to talk to my perl script. Here is a movie showing off getting it working for the first time! Being Flash we will be able to add a lot more visuals of CAN data in the future (hopefully the near future)