Neuroquila-n8fall / odroid-carpc-nano33

Derivate of odroid-carpc-due for the Arduino Nano 33 IoT
0 stars 1 forks source link

odroid-carpc-nano33

Derivate of odroid-carpc-due for the Arduino Nano 33 IoT An Arduino Due project for controlling an Odroid N2 via BMW Keyfob and iDrive.

Alt Text

Hardware used

Purpose

This project is intended to support an Odroid N2 in its function as a car-pc. This also involves controlling the display brightness of the Vu7+ display by applying PWM signals to its backlight chip by reacting on the cars' light sensor on the windscreen. As a bonus it's designed to support an iDrive controller as an input device for the Odroid to have comfortable access to the car-pc functions. To make it function properly an app called "Button Mapper" is used to react on F-Keys. See: https://play.google.com/store/apps/details?id=flar2.homebutton

Electrical Details

The brainbox of this module is a Arduino Nano 33 IoT which has its own 3v3 voltage regulator on board. To reduce stress it is supplied by the onboard 5V regulator from Recom. This 5V supply also powers the TJA1050 controller which needs 5V in order to generate the signals on the CAN-Bus. The Bluetooth module, MCP2515 and INA219 are supplied by the Arduino's voltage regulator.

The 5V Regulator is supplied by an external power supply and tolerates a maximum of 12V.

Because of the internal wiring of the Arduino, even the Fans will work when the Arduino is powered via USB. You will read 3V on the 12V rail if only the Arduino is plugged in to a Supply via USB. I've missed to include a Schottky Diode in order to prevent this behavior but it doesn't hurt either because everything is on the same potential and the internal regulator of the Arduino can deliver 1A continously. This also enables you to diagnose things on desk without hooking up everything to a external DC supply.

Part selection

When selecting parts I've focused to select hose which are either AECQ100 certified or have an extended operating temperature range until at least 85°C. You should select parts for automotive use to ensure they last as long as possible.

- ATTENTION: Contrary to the schematics and board, the TCMT1100 up to TCMT1102 optocouplers can be used.
The TCMT1104 requires 10mA to trigger which the SAMD21 can't deliver. It's maximum current on a pin is 7mA

Fan sockets

The PWM signal is tuned to work with all fans. I've tested bog standard 120mm fans as well as a dual high-pressure cisco switch fan. Please note that the socket delivers the voltage from the 12V rail. There is no possibility to power 5V fans here.

3rd Party Libraries used

I'm using a modified version of the BPLib that now supports sending and holding multiple keys. That's probably important for future tweaks. The original library only supports sending one single key and modifiers. See: https://github.com/Neuroquila-n8fall/BPLib

Also: Seeedstudios Canbus Shield library See: https://github.com/Seeed-Studio/CAN_BUS_Shield

Usage

Intended Usage & prerequisites

The main key aspect of the layout is to connect an external power supply which is supplied by the battery of the car through the board. The intention behind this is to keep everything safely connected. Cars are very flammable and therefore the top priority has to be that there is no risk of loose, uninsulated wires dangling around!

A DS18B20 temperature probe is required in order to keep track of the temperatures of the pc and control the fans accordingly.

Wiring

This new revision has everything on board which makes wiring very easy. It also minimizes the amount of wiring. Alt Text All of the terminals have a Description on the bottom which usually is hidden by the terminal itself. That's why a more descriptive text is added to the top. You'll find a Terminal for the following auxillary devices:

Color blocks explained

Parameters

Parameters are described inside the source file "main.h" (https://github.com/Neuroquila-n8fall/odroid-carpc-nano33/blob/master/src/main.h) Everything is well tested and works right out of the box. The prototype is already reaching one year of service on my car and shares the same code base.

I2C

There are two solder pads "SCL-N" and "SDA-N" on the bottom to be bridged when you want to establish I2C communication between the Odroid N2 and the Arduino. This will join the N2 to the Arduino I2C bus. Important: The Arduino is the bus master! Alt Text

First-Run

Bluetooth Module Setup

Before uploading the sketch to the Arduino, you should head over to the setup section and uncomment the line "initalSetup()". Then, head over to the function and customize the name of the device and PIN. This will then set the required settings on the next startup of the Arduino on the bluetooth module so it works as intended. You may also use a Serial redirection sketch to enter the commands yourself or tweak things. After that you should comment the section again and re-upload the sketch.

Functions & Behaviour

Startup

When you open the car by keyfob, the PC will be started by pulling down the power button GPIO pin on the Odroid for a second. This will turn on the Odroid.

Shutdown

When you close the car by keyfob, it will pull down the GPIO pin again but now for several seconds which triggers the shutdown routine of the Odroid so it shuts down gracefully.

Queuing

You can queue exactly one action by pressing "open" or "close" on the keyfob respectively.

What does this mean?

This means that if you want to take something out of the car and leave it again, you will have to press "open" and "close" in a rather short timespan. usually this would mean the startup process will be terminated or the PC will run until you enter the car again or press the "close" button again after the Pc booted up. Instead the controller stores the second action and waits for the PC to boot up and then shuts it down gracefully again. Because we never now when a "open" is followed by driving or just for accessing the car for a short duration this system prevents ungraceful shutdowns or battery drain.

Vice-Versa this means when closing the car and re-opening it again, the Odroid will be started again shortly.

Battery Monitoring (WIP)

Things worthy of noting:

Signalling & Diagnosis

There are plenty of status led on the board:

Known Issues

Solved: Explicit correction of values that are out of range. When the car has recovered from a very low voltage level, the light sensor reports values that are not mapped correctly by the "map" function. Such values are now being overwritten

Solved: Same issue and solution as above

Questions I got asked...

Why all the hassle if I could just simply upgrade the car to the official iDrive? Because I always felt the need to include a full blown car pc into my car. Upgrading to iDrive wasn't an option due to the fact that this system is just too limited. If I had a recent model, this wouldn't be a problem but sitting on a rather "old" car leaves one without options. I want a browsable music library with cloud sync, internet, the precious Torque app, ...all the good stuff! The icing on the cake was the decision to go the extra mile and swap the center console and install an iDrive 7-Button control unit. It looks like OEM but it does much, much more.