Using an Arduino UNO for Your DEF Simulator
The DEF Simulator can also be built using an Arduino UNO or ATMega2560 board. The UNO/ATMega2560 boards require the use of an additional board called a CAN shield.
Note: It is highly recommended that you program the Arduino board before starting the assembly of the DEF simulator. Please see the Programming section at the bottom of this post.
The Arduino UNO or equivalent can be purchased from online retailers such as Amazon. Here is a link for one on Amazon:
The CAN shield (V2) is made by Seeed Studios and can be purchased directly from them, Amazon or other online retailers. Here is a link for Amazon :
The assembly will also need a female DB9 connector to attach the wires to the vehicle connector. This connector can be purchased from Amazon:
The entire assembly of the UNO with the DB9 connector is slightly larger than the size of an Arduino DUE, so it will require a larger enclosure. Here is one from Amazon that will work:
The Seed CAN shield will need a small wire trace to be cut before use. Cutting this run removes a termination resistor that is not needed when connecting the simulator to the vehicle. The wire trace is connected between the blocks labeled P1 on the back side of the shield. The run can be cut with an X-acto knife or box cutter. Do not cut too deeply so as to damage the board. The trace is not very thick.
The cable and waterproof gland nut (shown in Quick Start section of main page) used on the DUE assembly can also be used with the UNO.
Link to cable: https://www.diodedynamics.com/dt-4-pin-extension-wire.html
As an alternative to the “Gland nut” you can use a rubber grommet, which can be purchased from most hardware stores, such as ACE Hardware. Just get one that will fit your cable diameter. You could also just fill the hole in the box where the cable goes through with silicone sealant.
The wiring connections on the 4 pin DT-4 connector are: +12v, ground, CAN-H and CAN-L.
The wires associated with these pins (above picture) are connected to the DB9 connector via the screw terminals.
Strip about 3/16 inch of insulation off each wire end and connect to the DB9 screw terminals. If the wire is too thick, cut off a few strands. Be sure there are no stray wire strands touching anything.
Pin 2 = ground Pin 3 = CAN-H Pin 5 = CAN-L Pin 9 = +12v
Make sure to move the switch on the CAN shield to the “ON” position (see Picture above).
Put a small piece of electrical tape to cover the entire top of the USB connector. This helps prevent pins on the bottom of the CAN shield from contacting the connector.
The CAN shield needs to be mounted on top of the UNO board. There is only one way for it to attach.
The finished board assembly can be secured in the box using Velcro.
Programming Your UNO/ATMega2560:
It is assumed that someone attempting to construct one will have a modest knowledge of a Windows based computer. The initial work was completed on a Windows 10 based machine, but it is expected that a Windows 7 or XP based machine will also work. The computer will need to have at least 1 available USB 2/3 port.
The software for the Arduino UNO can be downloaded from: https:/https://github.com/flyboy013/DEF_Sensor_Emulator_Firmware/blob/main/DEF%20Simulator%20Install%20Files%20v0.2%20(x32).exe/github.com/flyboy013/DEF_Sensor_Emulator_Firmware.
The download file (DEF Emulator Install Files v0.2(x32).exe) is a self-extracting file that will include the compiled Arduino software appropriate for your hardware configuration ( .bin or .hex) and files for actually programming the Arduino. It is not necessary to install any additional software from Arduino or anywhere else.
Save the file somewhere convenient on your computer. The Windows Desktop will do nicely. After the file is downloaded, just double-click the file and it will automatically create the required directory structure on your C drive and copy all necessary files into their appropriate locations. It will prompt you to verify the destination directory, just accept the suggested default. You may see warnings from your anti-virus software on your Windows computer and you may have to deal with those to allow the installation to run. The downloaded installation package will create the following directory structure in the root of your C:\ drive:
Using an appropriate USB cable, attach your Arduino board to your computer. Please note that the DUE has 2 USB connections, the one nearest the black power connector is known as the “Programming Port” and it is the one you should use. Note that the preceding sentence applies only to the DUE. Some LEDs will light up on the board showing power is connected via the USB cable. Open the Windows “Device Manager” tool and expand the “Ports (COM & LPT)”. You will need to make note of the number of the COM port being used by the Arduino. Note that the Port may also be shown as a “USB Serial Device (COM xx)”.
Close the Device Manager window.
Open the Windows CMD program ( on Win10 right click the windows icon at lower left, select run, type CMD in the box and hit OK). A “CMD” window should open.
In the CMD window type: cd\AVRProg and then hit the enter key. The prompt should now indicate: C:\AVRProg.
The file “program.bat” will be used to upload the compiled Arduino software to your board. Program.bat takes 2 inputs to operate correctly: the board type and the COM port number. The board type can be UNO, DUE or atmega. You can use all upper-case or all lower-case but you cannot mix upper and lower cases. The COM port number will be 1,2,3 etc (just use the number part. Don’t type the ‘COM’ OR ’USB‘ part) that you found from Device Manager.
As an example to program a UNO on COM port 4 use:
Program.bat uno 4
For a DUE on port 3 use:
Program.bat due 3
Type the required command in the CMD window and press the “enter” key.
A lot of information will scroll by on the CMD window. As example for the UNO:
And at the completion:
The Arduino board should now be programmed.