My plans with OpenXC (New Dev)

Skip to first unread message

Adam Musciano

Aug 27, 2020, 1:55:20 PM8/27/20
to OpenXC
Before I found out about OpenXC, I was driving a 2003 f150. I had been attempting to make my own open-source logging system for any vehicle with OBD II. Now that I know Ford openly supports developers doing this and I have a vehicle that supports it, I'd like to contribute. If anyone likes this idea and would be open to talking about it with me, I would really appreciate it.  This is part of a bigger data collection project, this truck being a "node" on my network.

Current Setup:
- 2013 Ford f-150 4wd, no factory cameras
- 100 Ah marine-grade 12v battery, charged by solar
- long range Yagi antennae with Alfa AWUSO36NH wireless adapter
- rasbperry pi 3
- elm237 OBD II Bluetooth dongle
- low-range omnidirectional USB wifi dongle
- GPS USB dongle
- 12v loudspeaker with aux adapter charged by the spare battery
- rearview video camera wiretapped off an accessory port so it is on when the engine is.

The raspberry pi has multiple functions, and I believe most of the functionality can be separated from it now that I can use OpenXC.

RPi Functionality:
- acted as a router, passively scanning for trusted wireless networks
-  persistently connects to the elm OBD adapter, logging the data I knew I could trust (had bad latency issues when querying for multiple sensors)
- logs GPS data every minute, detecting idle position to save on data accumulation
- when a trusted network is found, dump all of the logged information to my server, effectively syncing when connected.
- While scanning for trusted networks, log public networks with gps location. (wardriving to find potential free wifi spots)
- Act as a hotspot when connected to a trusted network. (used long range antennae as input adaptor, low range omnidirectional dongle for output hotspot)
- OpenVPN connection back to my server so all internet traffic is logged as my own when in use. This makes it so the router looks like a node off of my home network (easier tracking and analysis).

Why all the wireless hotspot stuff?
The wireless network scanning was done because I was still working on a solution where I could get all of this sent over 4g. Right now I only can know of what happened with the vehicle once it has synced, which might not happen for a while if I'm not home. I found a few IoT data plans that I was thinking of using as a way to sync crucial information like GPS location back home. But with the hotspot feature, my usage would've been out of the realm of IoT. I really need a prepaid unlimited data plan. Preferably one where multiple sim cards can share the same plan so I can have a network of my remote-access enabled devices. I know OpenXC has an adapter, maybe someone knows of a provider that fits this? There are so many third-party providers, I'm tired of accidentally bricking 4g USB modems trying to get them to work.

Logging and Actuation
I see this as a two-part issue -- logging and actuation. I haven't even gotten to actuation yet because of the 4g data plan issue. I first need to recreate and extend all of the above functionality. Then, I think it should be trivial to have it periodically ping a beacon for new events to execute, then bam, actuation is done.

An example: "Where's my car? I'll ask my home server. Oh there it is, can I get a picture from the rear camera? Huh, still can't tell where my car is but I know I'm close, let me find my car by triggering a song to play on the external loudspeaker"  ...I get lost in parking garages more than I'd like to admit. This is an example of responsive data over callback vs querying a database for the last sync.

Intended Automations:
- all available vehicle sensor data should be logged, and the data should be in accordance with the time it was recorded
-  logged data should be sent home
-  I should always have internet that I can connect to using the local hotspot, with enough bandwidth to do multiple video conferences (we're talking 40gb+ data usage in a month)
- google maps on the head unit
- image data from connected cameras

How do I separate this out?
So now you know a little about this multi-year project I've been playing with. I want to polish what I make and have it somehow incorporate into OpenXC so other people can take advantage I've what I built. I need to figure out what OpenXC can and can't do for me. From the research I've done so far, this is what I think I need to do:

1. Get the Ford VI, which means I can't use the C5 with cellular/sd card built-in.

2. Replace my head unit with an android unit that is compatible with OpenXC, wire it directly with USB OTG (recommendations are welcome, no clue what I'm doing). Now any vehicle data must come through the android.

3. Setup up the wireless hotspot stuff separately using my battery charged by solar, smart switching, and persistent OpenVPN connection handled by PFsense. This way my router is truly a router and not just a black box handling every connection. No more raspberry pi, just a pfsense router, and the tablet.

4. Have the android head unit only accept that hotspot as a possible connection. The table should always be connected since the router is handling the network switching and VPN This means the tablet is now a client of the router ( aka a client of my home network on a subnetwork).

5. Build/find an OpenXC app for android that handles logging this data and pinging my beacon for new events. I still would want some sort of storage buffer of this in case there is no cellular signal, so I can dump what's not been synced when I do have signal. At least right now, a week's worth of accumulated data would be only 400mb. Should be fine in SQLite if I get a nice enough tablet. Maybe set a buffer cap so it can't store too much if something breaks. This was all on a 32gig sd card on the pi before.

6. Add cameras as sources to the tablet. This way I can have selectable cameras when I'm driving (ie DIY smart rear view cam), and have the tablet take a picture to send back home if asked. I'd eventually like to do server-side computer vision on the cameras to detect and identify objects, like reading license plates.

7. hook up the loudspeaker charged by the solar battery to the tablet's audio. Seems like I'll need to do this over bluetooth since the stereo system will need to use the tablet. So the app will also have a speaker choice option, to choose whether audio is playing in or outside of the car.

8. add a GPS dongle to OpenXC (will my USB dongle still work?) Seems like I'll need some sort of USB bus for all the devices the tablet will have connected to it, and I'm concerned about power drain through the one tablet port. Seems like at least one camera, OpenXC, and the dongle will need access, while also charging the tablet.

I think if all that gets finished, I should have what I need to start really making some cool things. Am I asking too much of OpenXC? Is there anything you see in my plan that seems unrealistic/impossible?  I know this is a long post, I can separate this thread nto smaller questions, or add diagrams if that helps. I hope someone else is as excited about the potential for this as I am, and if you are -- I would love to collaborate! A lot of what I've already built is released publicly, I'd be more than happy to share my tools.

As anyone who has ever popped out a head unit knows, it's scary taking your car apart the first time. I don't expect this to fully work the first time around, but I am concerned of buying all this stuff, trying to install it, and then nothing works.

Thank you for your time, effort, and documentation :)

Eric Marsman

Sep 11, 2020, 9:03:48 AM9/11/20
to OpenXC

That is quite the impressive setup. A few comments. 

I understand the want to replace the head unit, but I would recommend prototyping everything with a phone too. You can get a cheap Android phone that will allow you to do all the same stuff. 

I think you are right to be concerned with the amount of stuff going on and having issues at the end. I don't see any major issues in what you have planned though. I don't think you're asking too much of OpenXC. I would shift most of the compute and processing to the Android device though. OpenXC doesn't have to be the center of the system. 

Let us know if there are any specific pieces you are struggling with and we'll see if we can help. A lot of the individual pieces you're talking about have been tried, but not all together, so we may be able to give you examples or pieces of stuff to get started. 

Good luck!

Rashaad Fontenot

Sep 22, 2020, 6:38:34 PM9/22/20
to OpenXC
I would be interested in discussing more on the project. I just bought a Ford Flex and want to start hacking around with it. I just ordered the C5 and am going to purchase an
I am interested in tuning my car via Cloud and remove the need for added hardware.
Reply all
Reply to author
0 new messages