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:

Link to gland nut:

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.

DB9 connections:

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.



Completed assembly:




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:/

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.

16 Comments to Using an Arduino UNO for Your DEF Simulator

  1. Wally says:

    Any alternatives for the cable? The 1M cable is backordered. I guess the 3M would work? Thanks to you all!!!

  2. David Harris says:

    Thank you for this work around! I did notice that the CAN shield and the cable connector that you spec’d are both male. Regardless, I appreciate your hard work and generosity for providing this.

    • RadarEng says:

      Yes you are correct, it is an error in the post. The DB9 should be a female connector. I have corrected the post. Thanks for catching this

  3. Roger Loomis says:

    I programmed the UNO board and it seemed to go well. It said “done” at the end but unlike the example all I saw were hash marks in the window. Just wanted to make sure that is normal.

    • RadarEng says:

      It does seem different than our experience. You saw only # and no other output?
      You can attach the CAN shield to the UNO and then connect the UNO to your computer with the USB cable. Look between the boards and there should be a blinking LED if its working as expected.

      • Roger L. says:

        Yes, only # no information. I connected as you said and had a blinking LED and other solid LEDs. So I guess it was programmed and working correctly.

  4. Michael Natinsky says:

    I see the instructions are very detailed. Is anyone offering to assemble and program this for a fee? If So I would like one otherwise I don’t feel skilled enough.

    • Voltdoc says:

      Michael, the DEF Sensor Simulator is intended to be DIY project, we suggest you tap your network of friends and acquaintances for someone with the necessary skills to help with the construction.

  5. Roger L. says:

    Question about the DB9 connector for the UNO CAN Shield. The PIN numbers shown in the instructions are reversed on the DB9:
    Pin 2 = ground is Pin 8; Pin 3 = CAN-H is Pin 7; Pin 5 = CAN-L is GND; Pin 9 = +12v is Pin 1.
    Should we disregard the numbers and connect the wires in the same positions shown in the instructions. Thanks

    • Roger L. says:

      I think I answered my question. I was looking at the wrong photo as I have not received the DB9 yet. I looks like the Pins in the female DB9 is as pictured in the instructions and the Pins on the male DB9 (also pictured in amazon) is reversed. Sorry.

  6. Dave says:

    I’m getting an error that says “This app can’t run on your PC”. It’s a Windows 10 machine, a little long in the tooth but is seems to work fine otherwise. I am running Norton security. I also tried to run it as an administrator and it didn’t work. I also tried running the compatibility troubleshooter with no luck either. Any ideas? BTW thanks for all of your hard work!
    I solved my own problem. There was a little upsidedown yellow triangle by the download icon in the upper right side of the screen. When I clicked on it it allowed me to download the file. I had downloaded a -0- byte file and I hadn’t noticed it an empty file. Sorry for the confusion. Now I’m just waiting on hardware.

  7. Beek says:

    The DT-4 cable is backordered, is there any reason I cant just use a DT-4 kit and make up my own pigtail, I already have the crimpers for them.

    • Voltdoc says:

      Sorry for the late response. It is perfectly fine to use a DT-4 kit, we just specified the cable because it is the easiest way to go for those not electrically inclined. You can either buy the kit where you supply your own wire and crimp on the pins and assemble the connector, or you can buy a pre-assembled connector which usually has about 6″ leads then add extension wires using butt crimps which most have the tools to do.

  8. Mark D Burton says:

    I purchased the canbed board and I am trying to program. I have downloaded the files which show up on my C drive. I followed the instructions and the first picture of the program shows up on the command prompt. Then it says: Connecting to programmer: .avrdude.exe: butterfly_recv(); programmer is not responding. Any help would be appreciated.

    • Mark D Burton says:

      I figured out what I was doing wrong. The board shows up on COM 4 when connected. When you push the reset button it switches to COM 5. I typed : program canbed 5 and the program downloaded.

  9. jon says:

    Comment regarding Win10 for non-Win users.

    I use an Apple iMac but keep a working copy of Win10 in a virtual machine for the rare occasion that I have to use it. Programming the UNO is one such case. While I’m fairly familiar with the commandline and use terminal mode frequently on the Mac, running it in Win10 threw me for a loop. MS has made it harder for novices to get in trouble running programs. First, I was using a shortcut to PowerShell and discovered that it won’t run .bat or .cmd files in the usual manner. Maybe there is a different terminal program that I should have opened.

    In the VM I attached the usb cable to the running Win10 (I don’t mean simply plugging it in, you have to tell the VM to connect to it). The old style Device Manager is not easily found in Win10, in Settings you can do a search for “Device Manager” and it will show up. It found my Uno on com3 after telling the VM to attach it.

    In powershell you must run .\program.bat with the required parameters for your programming of the board.

    It appeared to install just fine, now I have to build it. Unfortunately, still waiting for the Seeed. Amazon had it ‘in stock’ but now it’s taking an additional week so I guess it was not in stock afterall.

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2021: DEF Sensor Simulator | Easy Theme by: D5 Creation | Powered by: WordPress
WordPress Cookie Plugin by Real Cookie Banner