Dismiss Notice



Register Today It's free! This box and some ads will disappear once registered!

Anybody play with Arduino / CAN-BUS? Looking for the front camera trigger

Discussion in '2017+ Sync 3 / In Vehicle Technology' started by XirallicBolts, September 2, 2019.

^^Searches ExplorerForum.com^^





  1. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    Hey all, greetings from the Flex forums. As you probably know, the Explorer gets all the fun new technology while the Flex has been completely forgotten by Ford. Pretty much the only difference between a 2013 and 2019 Flex is Sync3 and paint colors -- no new features. They haven't even bothered to update the steering wheel to match virtually every other US-market Ford.

    I always find some way to modify my cars. On my 2008 Milan, I retrofitted Sync into it. On my 2010 Milan, made it so the Ford Gen-II remote start would also activate heated seats and defrost. Last month, made it so my Flex could be remote started via text message because the factory keyfob has just dreadful range.

    My current project is adding a front camera to my 2016 and I'm using the Explorer as a template. I have the camera working but it can only be activated by putting the car into reverse and using the rear camera delay. On the Explorer, there's a button to manually trigger the front camera. I know the signal is sent over CAN-BUS, but I do not know if the button signals the IPMB, which then signals the APIM, or if the button signals the APIM directly. I do know the IPMB determines which camera is actually connected to the APIM.

    I know it's a long shot, but it'd be awesome if someone around here has played around with Arduinos or CAN-BUS sniffers and could find out what signal is being sent to the radio to tell it 'Display a video until you hit 5mph' without putting it in reverse first. There was an option in Forscan for 'Front Camera' on the APIM, so I'd imagine there's a specific signal the APIM is equipped to receive. Unfortunately I don't know anybody in real life who has a camera-equipped Explorer and dealers certainly aren't going to let me hook up some random electronics to the OBDII port of their inventory. Everyone I know has F-150s and the 360° camera system on that is too different.

    Any information would be greatly appreciated!
     
  2. Support EF

    Join the Elite Explorers for $20

    Explorer Forum has probably saved you that much already, and will continue to save you money as you learn how to diagnose fix problems yourself and learn which modifications work without having to experiment on your own. Elite Explorer members see practically no ads, can add their own profile photo, upload photo attachments in all forums, and Media Gallery, create more private Conversations, and more. Join Today. Your support is greatly appreciated.



  3. peterk9

    peterk9 Staff Member Moderator Elite Explorer

    Joined:
    December 28, 2010
    Messages:
    24,763
    Likes Received:
    1,153
    Trophy Points:
    143
    City, State:
    Ottawa, Ontario area
    Year, Model & Trim Level:
    2017 Explorer Platinum
    Callsign:
    VE3
    Welcome to the Forum.:wave:

    Peter
     
  4. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    Thanks, Peter!

    I knew it'd be unlikely but didn't hurt to ask. Finding the messages being sent across CANBUS can be a powerful tool.

    Let's say you drive a lot at night and like to turn the screen off. It's a bit of a hassle going to Settings > Display > Screen Off, so find the right messages and you can have it where pressing the Power button for 2 seconds shuts the screen off. Did a little bit of test coding, and it works!

    Maybe you switch between heat before work and AC after work. A little bit of code and long-press Fan Down to set it to 75°F, Low Fan, Top and Bottom vents. Long-press Fan Up, 60° / Medium Fan / Top Vents. Either add a temperature sensor or find the code for the car's ambient temp sensor and have heated seats / steering wheel come on automatically when it's below freezing. Sky's the limit.

    I was hoping to find the messages to kick in the front camera view, then I'd have it triggered by either long-pressing the Eject button or swap in a gearshift lever with Descent Control buttons to manually activate the camera. I simply do not have access to ANY Ford vehicles with the factory front camera to read that code.
     
    • Like Like x 1
  5. MM07

    MM07 Elite Explorer

    Joined:
    January 13, 2019
    Messages:
    239
    Likes Received:
    59
    Trophy Points:
    28
    City, State:
    MA
    Year, Model & Trim Level:
    2018 Explorer Limited
    Sounds interesting. Would be nice to have in my 18.
     
  6. Ferretkingdom

    Ferretkingdom New Member

    Joined:
    August 26, 2019
    Messages:
    48
    Likes Received:
    3
    Trophy Points:
    8
    City, State:
    LEHIGH ACRES
    Year, Model & Trim Level:
    2018 Explorer Limited
    I have a 2018 explorer with a front camera, and I know my hubs has played with some Arduino stuff, but I don't understand much of anything else you said. Lol. What equipment would be needed to find out what you're wanting to know? I can see what he has
     
  7. tlveik

    tlveik New Member

    Joined:
    February 10, 2015
    Messages:
    35
    Likes Received:
    2
    Trophy Points:
    18
    Year, Model & Trim Level:
    2018 Explorer XLT
    I have arduino experience and have worked with LIN buss and a very small amount of work with CAN bus. But neither on an actual automobile. I have a LIN bus sniffer and might be able to get a CAN bus sniffer. What are you using to send your custom commands?
     
  8. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    My apologies, I thought I had this set to email with new messages.

    I used an Arduino Uno with the ElecFreaks (edit: wait no, MakerFocus) canbus shield to test on my Flex. I did eventually get a method that works. Couldn't find a hidden Front Camera button so instead I have it watch for gear changes. I'd still prefer to find a front camera button signal because, as I understand it, you can activate that while driving? My method can only do it once you come to a complete stop.

    Still a bit of a work-in-progress, but I'll write it up a bit more tonight giving details. Costs about $100 in parts including an aftermarket camera, no modifications to the existing vehicle wires necessary.
     
    Last edited: October 2, 2019
    • Like Like x 1
  9. Ferretkingdom

    Ferretkingdom New Member

    Joined:
    August 26, 2019
    Messages:
    48
    Likes Received:
    3
    Trophy Points:
    8
    City, State:
    LEHIGH ACRES
    Year, Model & Trim Level:
    2018 Explorer Limited
    I have a front camera, but I can't activate it while driving at anything other than parking speeds. Sp, not at a complete stop, but not at actual driving speeds
     
  10. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    So below 5mph it can activate? That'd be better than the current "0mph" requirement. Right now I have it set where shifting to S will bring up the camera, which works but I'd prefer to swap my shift knob for one with the O/D button instead to signal it.

    Maybe tonight I'll see if spamming the reverse message would work. Kind of a Denial-of-Service attack on the radio, preventing the "Car's in Drive" message from getting through
     
  11. Ferretkingdom

    Ferretkingdom New Member

    Joined:
    August 26, 2019
    Messages:
    48
    Likes Received:
    3
    Trophy Points:
    8
    City, State:
    LEHIGH ACRES
    Year, Model & Trim Level:
    2018 Explorer Limited
    I'm not sure a specific MPH, but yeah probably 5 or under? I can test it when I go out in a bit.
     
  12. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    Tried recording a video of how I did all this, but apparently my laptop doesn't like recording more than 5 minutes and I tend to sound like a bumbling idiot. I also tried the "spam camera messages" I mentioned earlier, but it upset the radio too much.

    The following assumes you at least know how to get an Arduino IDE up and running (plenty of guides online). I hate how this sounds super complex as I'm typing it, but it's really just a lot of little things strung together. With an Arduino IDE ready to go, this whole thing would take like half an hour to do depending on how lucky you get finding codes.

    The hardware I used was a clone Arduino Uno and a MakerFocus CAN-Bus Shield. It needs to be connected to the I-CAN / HS3-CAN lines. On the Flex, it's pins 1 and 9 on the OBDII port. On most Explorers, it's a test connector (C2122) located nearby, Green/Blue for CAN+, White/Green for CAN- (verify with your specific years' wiring diagrams though).

    Initial 'read CANBUS' code, modified from SparkFun's defaults. I have Serial set to 500,000 baud, so make sure your Serial Monitor is set to the same instead of the default 9,600.

    A quick guide on how to use Excel's Pivot Tables to compare data. He's using a Forscan-style USB reader and his Wrangler's data is very different from ours, but his Pivot Table data comparison method works wonderfully.

    .I initially tried reading the messages when you press the front panel buttons since the Flex and Explorer panels are so similar. I'd been posting on the F150 forum as well, including when I found the codes for my front panel buttons. Since only the first byte changed, I tried looping through all 256 possible values for that first byte. Unfortunately none of them matched the front camera button. If someone with a front camera were to test that Read CANBUS code above, I'd ask they try filtering just messages from ID 2A0 and, after verifying they see codes when pressing Next / Back / etc, see if a code pops up when Front Camera is pressed. That's the code I've been searching for this past month.


    Since I couldn't find the 'front panel button' code, I went with tricking the radio into thinking I'm in reverse.
    Had the car in Accessory mode and let it run for a minute, in Park, radio off, not pressing anything. Got a nice baseline reading for the Excel spreadsheet. Grabbed another reading while shifting from Park and Reverse, dropped it in another sheet and used his formula =IF(ISNA(MATCH(A2,baseline!D:D,0)), A2, "-") to show only new messages from the Park/Reverse run. Another sheet, another run doing it between R and N.

    Google Spreadsheet of my results plugged into Excel. Works best if you download it and actually open in Excel. Note that this was before I tweaked the program to format better, so mine lacks the leading 0s. Makes no difference besides readability.

    Once I had a few different gearshift runs tested, I looked through what new messages I had. There were only a few unique IDs. For each one, I'd modify the Arduino code to filter just that unique ID and watch the monitor again as I shift gears.
    ID 91: Updated once per second. That's actually the clock, as byte 4 corresponds to the current Seconds counting up to 3B before resetting to 0 (in Hexadecimal, so 3B is 59 in decimal)
    ID 40A, 463 and 464: No effect
    ID 45E: Sends random blocks of data every second, not corresponding to gear changes.

    But then, ID 109. Every time I shifted, it updated. Eventually sussed out this format:
    ID: 109, Data: 00 03 11 00 00 00 28 0
    00 03: Current RPM, multiplied by 4, in hex. So a value of 1B 4F in hex is 6991 in decimal, divided by 4 is 1,747 RPM
    11: Current gear. 01 is Park, 11 is Reverse, 21 is Neutral, 31 is Drive, and 41 is Sport/Low/Manual/Whatever.
    00 00 00: Current speed, possibly multiplied by 2, in hex. Car wasn't moving so it's all zeros.
    28: Ignition mode. 28 is accessory, 48 is cranking, 58 is engine running.

    A simple example code for triggering the camera view. If the vehicle's speed is below 2mph or so and it recieves a message indicating you're in Sport gear, it modifies the message to say you're in Reverse and immediately sends it out.

    The reason you have to be nearly stopped is because of the update interval. If you filter ID 109 and drive around while watching the Serial Monitor, you'll notice that it updates slowly (once per second) when at a stop. But while driving, it's updating 20 times per second with updated speed/RPM values. When we inject a fake Reverse signal, it's not blocking the existing Drive signals.

    When stopped, the length of time between our Reverse and a genuine Drive is long enough that the radio switches to camera view and will remain in camera view until it sees a "Drive, 5mph" message. While driving, the messages are simply arriving too fast that the radio doesn't have to switch to Camera View before it already got a new message saying we're in Drive. Theoretically knowing that Front Camera button would trigger a different routine that enables the camera view as long as we're below 5mph even if in Drive.

    My current 'main camera' code, which has a DPDT relay connected to Pin 7 on the Arduino, the relay switching between the front and rear cameras. Additional code is used to force it to stay on Rear Cam by pressing the Eject button (if you're trying to line up a hitch) and turn off the screen if you hold Power. I may change it in the future for opposite behavior with a default relay state of Rear instead of Front. That's more of a holdover from when I was using the reverse lamps to trigger it.

    Thread on the Flex forum where I was documenting my initial testing and the camera / wiring involved in all this. The hardware is quite simple too, all Amazon-bought components. Aftermarket camera, APIM extension cable, Arduino Uno, canbus shield, a DPDT relay, and some prototyping jumper wires.
     
  13. peterk9

    peterk9 Staff Member Moderator Elite Explorer

    Joined:
    December 28, 2010
    Messages:
    24,763
    Likes Received:
    1,153
    Trophy Points:
    143
    City, State:
    Ottawa, Ontario area
    Year, Model & Trim Level:
    2017 Explorer Platinum
    Callsign:
    VE3
    My front camera also will work at the low speed. I've triggered it ON when driving into a parking spot.

    Peter
     
  14. MM07

    MM07 Elite Explorer

    Joined:
    January 13, 2019
    Messages:
    239
    Likes Received:
    59
    Trophy Points:
    28
    City, State:
    MA
    Year, Model & Trim Level:
    2018 Explorer Limited
    Yes this is true in mine as well.
     
  15. MM07

    MM07 Elite Explorer

    Joined:
    January 13, 2019
    Messages:
    239
    Likes Received:
    59
    Trophy Points:
    28
    City, State:
    MA
    Year, Model & Trim Level:
    2018 Explorer Limited
    I think there might be an issue. I don't get any updates with emails for anything....
     
  16. peterk9

    peterk9 Staff Member Moderator Elite Explorer

    Joined:
    December 28, 2010
    Messages:
    24,763
    Likes Received:
    1,153
    Trophy Points:
    143
    City, State:
    Ottawa, Ontario area
    Year, Model & Trim Level:
    2017 Explorer Platinum
    Callsign:
    VE3
    Although it isn't necessary to do this for threads that you posted in, have you set the threads you are interested in to "Watch Thread" if they are not set that way? No issues here getting email notifications.

    Peter
     
  17. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    It notified me this time. Maybe I just did something wrong. Possibly, when I followed the link for the first reply, I wasn't logged in so it didn't send further emails until I 'read' the new messages logged in.

    So far I'm happy with shifting to S for the front camera, but still holding out hope for a proper 'camera button' signal.

    After a thread with the Flex forum, now I'm curious about custom colors for the ambient lighting. I need another scanner to see if the signal from the apim to hvac is "set to ff00ff (purple)" or "set to color 7" and purple is hard-coded into the hvac. If the former, in theory I could have custom colors
     
  18. peterk9

    peterk9 Staff Member Moderator Elite Explorer

    Joined:
    December 28, 2010
    Messages:
    24,763
    Likes Received:
    1,153
    Trophy Points:
    143
    City, State:
    Ottawa, Ontario area
    Year, Model & Trim Level:
    2017 Explorer Platinum
    Callsign:
    VE3
    I get email notifications even when not logged in.
     
  19. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    Back from vacation, some new goodies arrived. My newest goal here is a Sync 3 Lockpick allowing video in motion.
    The theory is sound -- two CAN modules, one on the vehicle and one on the APIM. When you want video-in-motion, it intercepts all the "at speed" messages to the APIM and replaces them with "driving slowly in reverse" messages. With enough wiring, theoretically allows you to activate side-mounted cameras using the turn signal.

    There's aftermarket products that exist to do this already, but I want to figure it out on my own for much cheaper -- $30 APIM extension, $10 relay, $20 controllers... vs $350 for the Rostras modules.

    Trying to gauge other peoples' interest in such a thing. Not limited to Sync3, I was able to trigger the camera on my 2010 (Sync 1) so with the right codes, Sync 2 would also work
     
  20. RhinoQuartz

    RhinoQuartz Elite Explorer

    Joined:
    December 16, 2018
    Messages:
    672
    Likes Received:
    106
    Trophy Points:
    53
    Year, Model & Trim Level:
    17 Explorer Base
    I'd be super interested in this. I've been recently looking at raspberry pis to see if it might be feasible to build a parallel system to the vehicles - for example for BLIS/CTA, dash camera, media center etc - and this sounds pretty cool.

    I do only have a SYNC 1, the 4" screen, but am happy to help as I can.
     
  21. XirallicBolts

    XirallicBolts New Member

    Joined:
    September 2, 2019
    Messages:
    8
    Likes Received:
    3
    Trophy Points:
    3
    City, State:
    Appleton, WI
    Year, Model & Trim Level:
    2016 Ford Flex Limited
    A little playing around, and video-in-motion works! I'm a tad surprised, I thought the reverse camera didn't work at all when at speed.

    I accidentally had my relay hooked up to 5v instead of 12v and I couldn't get a reliable connection with the cheap hobby-grade wires I was using.

    It's definitely a viable deal, it'd just take higher-quality parts. Absolutely possible for someone to put side cameras on their F150/Explorer and have it triggered by turn signals.

    Wanna go further? As long as it's a composite video signal, how about the camera on the rear of your camper? Tap a button or flip a switch and it'll show your camper's camera.
     
    • Like Like x 1

Share This Page







We Support Our Troops!