DEF Sensor Simulator – CanBed RP2040

Assembling a DEF Sensor Simulator Using a CanBed RP2040

Only basic electrical and DIY skills are required for the hardware assembly, however some basic soldering is needed to install the 4 pin connector. There are many YouTube videos that can teach you to solder. For delicate electronics such as this use a low wattage grounded soldering iron (25 – 30 Watts) to help prevent pad damage, don’t use a soldering gun.

The software installation in this procedure can be done from Windows or MacOS and is very easy.

Before you begin, please click here to read an important compatibility notice regarding the ECM (Electronic Control Module, aka Engine Computer) and info on compatible DEF head connectors.

If you run into difficulty post a comment at the bottom of this page.

Please read through all the instructions FIRST before beginning the project.  There are web site links embedded in the instructions to help obtain parts.

NOTE: before mounting in the enclosure box, the CanBed needs to be programmed! Please see instructions in the Programming section for Windows and MacOS.

Tools:

• Drill & bits
• Wire cutters / Strippers
• Small screw driver
• Ohm meter (multi-meter)
• Silicone sealant (optional)
• Soldering iron & solder

Parts List:

1) The CanBed RP2040 board can be obtained from several online sources. The suggested source is Digikey.com p/n: 1597-102991596-ND and ships from the USA.

It can also be obtained directly from the manufacturer or Seeed Studio distributor. Note that it ships from China, so it takes longer to arrive.

2) You will need a USB cable with a micro USB connector, as the board does not come with one. They are available at online retailers or in many stores. This MUST be a fully connected cable, not just a charging cable.

3) Weather tight enclosure. The entire assembly of the CanBed RP2040 is very small. The larger enclosures used on the UNO or DUE variants will work just fine, although they are larger than needed. Feel free to get a smaller one if desired. Here is a smaller one from Amazon that will work ( as an added bonus this also has the gland nut).

4) The cable ( Spartan and PowerGlide chassis or any other using the DT-04 connector) and waterproof gland nut used on the DUE assembly can also be used with the CanBed RP2040. If a shorter cable with the DT-04 connector will work for your coach, here is one from eBay.  If you have a Freightliner chassis refer to this post for the correct connector.

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.

Assembly:

It is recommended that you program the CanBed RP2040 board before doing the assembly. Please refer to the Programming section at the end of this document.

Take the 1 Meter DT Extension cable that you purchased and cut the off the flat end with the exposed orange silicone as shown in the picture below, approximately 1 inch from the connector end ( if using the short cable from eBay, cut right where the wires enter the unneeded connector). The short end with the Orange silicone connector will not be used electrically, but if desired can be used as a “dust cap” for the DEF head sensor connector when the DSS is not in use.

After cutting the cable, trim back the outer jacket about 4 inches and expose the 4 inner conductors.  Be careful to not nick the wires.

As mentioned at the beginning, the CanBed RP2040 needs to have a connector soldered to the board. The connector comes with the board. You can optionally directly solder the cable wires to the board if you wish. If you choose to solder the wires directly, you will need to feed the wires through the enclosure first, before soldering the wires to the board.

The connections on the 4 pin DT04 connector are: +12v, ground, CAN-H and CAN-L.

The wires associated with these pins (above picture) are connected to the CanBed RP2040 via the screw terminals. You will need to use an ohm meter (multi-meter) to determine which wire is connected to which pin, as the wire color codes are not standardized.

Drill a hole through the enclosure to accommodate the cable and gland nut (or grommet, whichever you are using).

Strip about 3/16 inch of insulation off each wire end and connect to the screw terminals. Make sure the slot is fully open as shown in the picture below. If the wires are too large, you can trim off a few of the strands.

Insert the stripped wires into the slots shown in the picture below:

Tighten the screws to securely fasten the wires in the slots.

The finished board assembly can be secured in the box using Velcro.  The smaller box will need one of the stand-offs in the bottom to be removed so the board will fit flat on the bottom OR the board can be mounted to the lid of the smaller box.

A completed assembly with larger box:

A completed assembly with smaller box:

NOTE: before mounting in the enclosure box, the CanBed RP2040 needs to be programmed! Please see instructions in the Programming section if this has not been completed.

Programming the CanBed RP2040 (Windows OS)

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 (USB drivers could be an issue). The computer will need to have at least 1 available USB 2/3 port.
The simulator software install file can be downloaded by clicking the download link below:
Download File

The file is usually downloaded to the “Download” directory on your Windows computer.
The download file (DEF_Sensor_Emulator_RP2040v1.ino.uf2) is a file that contains the compiled Arduino software appropriate for the CanBed RP2040 board. It is not necessary to install any additional software from Arduino or anywhere else.

1) Using a micro USB cable, connect the CanBed RP2040 board to your computer’s USB port. You should see a LED light up next to the micro USB port on the CanBed board. This indicates power to the board.

2) Open Windows File Explorer and find your download file (usually in the “Download” directory)

3) Right click on the download file name and choose “copy”.

4) Push and HOLD the reset button. While holding the reset button, push and HOLD the boot button. Release the reset button, wait about 3 seconds and then release the boot button.

5) A new Windows File Manger window should open. If one does not open, manually open File Manager and look for a new “drive” to be present and click on it.

6) Right click in location as indicated in the above picture and choose “paste”. This will copy the download file to the RP2040 board. When the file is copied, the File Manger window should close.

7) Wait about 5 seconds and then the LED below the reset button should begin to flash 2 times quickly and then the flash repeats. This is a good indicator that the board is working as expected. There are 2 LEDs to the right of the micro USB connector, labeled RX and TX. These 2 LEDS will probably be on solid (usually red in color).

8) Unplug the board from the USB port.

9) Programming is now finished.

Video after programming:

Programming the CanBed RP2040 (MacOS)

It is assumed that someone attempting to construct a DSS will have familiarity with a MacOS computer.  The computer will need to have at least 1 available USB 2/3 port.

The simulator software install file can be downloaded by clicking the download link: Download File

The file is usually downloaded to the “Download” directory on your MacOS computer.

The download file (DEF_Sensor_Emulator_RP2040v1.ino.uf2) is a file that contains the compiled DSS software for the CANBed RP2040 board. It is not necessary to install any additional software.

1) Using a micro USB cable, connect the CANBed RP2040 board to your computer’s USB port. You should see the PWR LED light up next to the micro USB port on the CANBed board. This indicates power to the board.

2) Open Finder and navigate to directory containing the downloaded file (should be the “Downloads” directory)

3) Push and HOLD the BOOT button on the CANBed RP2040. While holding the BOOT button, push and release the RST (reset) button. You will see the CANBed RP2040 show up as an external disk.  Once it shows up (a few seconds) you can release the BOOT button.

4) Within Finder, drag the DEF_Sensor_Emulator_RP2040v1.ino.uf2 file to the RP2040 disk (mine shows up as RPI-RP2, yours may be different).  Once the file has been copied, the CANBed RP2040 will reboot and will not longer be displayed in Finder as an available disk.  You will likely get a warning that the disk wasn’t properly ejected.  This is normal.

5) Once the CANBed RP2040 has rebooted, the “LED” light will continuously flash 2 times and then there will be a slight pause. This is a good indicator that the board is working as expected. There are 2 LEDs to the right of the micro USB connector, labeled RX and TX. These 2 LEDS will probably be on solid (usually red in color) indicating that the board is not yet connected to a CAN Bus (ie. your coach).

6) Unplug the board from the USB port.

7) Programming is now finished.

The below animated gif shows the process of installing the DSS firmware to the CANBed 2040 board.

Connecting to your motorhome CAN network:

  1. Make sure that before you unplug your def head that the ignition is turned off, then unplug your def head. You may need to cut a zip tie to provide working slack in the wiring.
  2. Plug the simulator into the connection to your chassis wiring where the def head was plugged in.
  3. Turn on your ignition, some or all of the fault codes should go away and the Check Engine and MIL (Malfunction Indicator Lamp) lights should extinguish within a few minutes.
  4. If some codes remain, to clear your codes you will need to turn your ignition on (let all systems come up, about 20 seconds), then start your engine and fast idle for 5-6 minutes, shut down for 90 seconds, turn ignition on (wait for systems to boot 20 sec) start engine and fast idle for 5 min. You will do this a total of 3 times on the 4 cycle the codes should clear to the inactive status.
    Note: on older engines or engines with older ECM software, some codes may not completely clear on their own. In this case code clearing intervention may be required. This is something that is still under study, see the Troubleshooting section for more info.

45 Comments to DEF Sensor Simulator – CanBed RP2040

  1. William McCoy says:

    Great instruction. Built 2 for powerglide. Absolutely PEACE OF MIND having these in the coach! Thank you gentlemen for making this happen.

  2. William McCoy says:

    Tested both units on a 2020 Tiffin Phaeton 40IH Powerglide Cummins 450hp. Both units tested outstanding. Exactly what your directions state. All codes cleared after turning engine off / on 3 times. Awesome job gentlemen. Thank you very much. Peace of mind.

  3. Ken Sinatra says:

    Want to order from Longan Technology and they have the CANBed RP 2040 powered by the Rasberry Pi RP2040 chip with a high performance MCP2515 CAN controller and MCP2551 CAN receiver operating at CAN2.0 protocols in 133 MHz.
    Is this the correct board?

    • Archer2 says:

      Yes this is one of the boards that has been shown to work. Even though it looks nearly identical to the 32U4-based board, the programming procedures are completely different. Please double check and verify that you are using the correct instructions for your board and that you are downloading the correct (.UF2) installation file from GitHub.
      Good luck

      • SG says:

        I have a longan rp2040 as well. I can’t get it to communicate or become available in the file manager. I tried different ports and different cables. Is there a primary program that must be programmed into the board first?

        • Archer2 says:

          Check your email for a message

          • Rob White says:

            Archer, I just ordered the longan rp2040 as that is the only one in stock. Are there other instructions on using this board?
            Thank you

          • Archer2 says:

            Hi Rob. First, I presume you mean that you ordered the Longan RP2040 CANBED board that was linked to or was the same part number as the one listed on the DefSim web sight, right? I want to be careful because the RP2040 is just the particular model of microcontroller on the board but the board includes other components that allow the board to communicate on a CANBED network. Longan has other products using the RP2040 that are not designed for CANBUS uses, hence the caution.
            Second I don’t know what you mean by “other instructions”. The instructions for using the RP2040 are different than the instructions for the several other types of Arduino-based boards that we have used but the instructions on the website specifically for the RP2040 are the correct ones to use.
            If you have more questions let us know, we’re happy to try to help.

          • Rob White says:

            morning Archer, here is what I ordered
            CANBed RP2040 is a CAN Bus development board powered by an Raspberry Pi RP2040 chip with a high-performance MCP2515 CAN controller and MCP2551 CAN receiver operating at CAN2.0 protocols in 133MHz.
            From reading the previous post, it sounded like there might be different instructions or a different file to download.

          • Archer2 says:

            You should be good to go. The instructions for using the RP2040 on this website are correct.

          • Rob White says:

            left off it was from Longan

          • Rob White says:

            Morning Archer,
            Appreciate your replies, the board and cable went together easily and the software downloaded with no problems. Keeping my fingers crossed I won’t need it but hopefully will keep me from being stranded on the road if the def does have a problem. Thanks for putting this out for everyone.

  4. Glen Moore says:

    I am using a Windows 10 computer (I have also tried my MacBook) I get a USB device not recognized driver error when I try to bring up the Windows screen so I can copy the the file into it. It look like I need a driver for this device I have the CANbed RP2040-CAN Bus I

    • Archer2 says:

      Do you see the RP2040 device in Windows File Explorer at all? Does it appear in Windows as a USB removable disk drive? Did you follow these instructions:
      “ 4) Push and HOLD the reset button. While holding the reset button, push and HOLD the boot button. Release the reset button, wait about 3 seconds and then release the boot button.

      5) A new Windows File Manger window should open. If one does not open, manually open File Manager and look for a new “drive” to be present and click on it.
      ”?
      If that doesn’t help can you give any more info on exactly what you are seeing?

      • Glen Moore says:

        I am a higher end computer user. No window opens and there is no device in the folder. I get a driver error when I plug it in and when I go through the boot up process. I get the same error

        When I go to device manager and look at the USB devices the port the device is connected to say it has a devices error and can’t correctly communicate with the device

        I have tried to update the driver may different way and they all say I have the most recent driver

        I need a driver specifically for this board or I have a bad board I hate to think the board is bad because I had it air shipped from China

        I have tried multiple USB cords and only my data cords will try to connect to the computer and gives me this error

        I have also tried my MacBook in this case my MacBook does nothing.

  5. Glen Moore says:

    this is the exact error I get in device manager under USB Devices

    Windows has stopped this device because it has reported problems (Code 43)

    I did some trouble shooting recommendation I found on the web for this error and nothing worked.

  6. Don says:

    Hello,
    I’m struggling trying to load the software onto the Arduino board. I get a no device found on COM 6 even though that is the verified port that shows. I do see the light blink sequence change as if it is downloading to the board and the windows pc makes a sound similar to when a jumpdrive is plugged in. Is there a method to verify the software was completed successfully? The board I have has a reset button but no boot button btw.
    Thanks, Don

  7. Phil Nail says:

    I have a 2013 Entegra Anthem with a Cummins ISL 450

    Which def simulator will work for my coach

    Thanks

    • Archer2 says:

      We have always made the assumption that the DSS was only for 2016 and newer coaches because the widespread failures were most commonly reported after the “DEF Quality Sensors” were mandated by EPA in 2016. However, even though your coach would not appear to be prone to the failures, if your coach uses one of the common connectors on the DEF Sensor the DSS may actually be able to be used to substitute for a failed OEM sensor.
      So if you would be interested in conducting a simple experiment I would be willing to send you a working DSS if you would be willing to connect it to your 2013 coach to see whether it works. Even if it doesn’t work I don’t believe it would cause any serious problems.

  8. Dave P says:

    Hello,

    I just assembled the CANBed RP2040 per your instructions and tried to download the software. Did the copy and paste and the Windows Explorer window closed per your instructions. The led next to the USB connection remained on, but no other lights came on. I repeated the download just to make sure but got the same results. Any suggestions?

    • Archer2 says:

      Hi Dave, I’m just posting here for the benefit of anyone who may be having a similar problem. As we discussed on the phone it appears that you understand the programming process and followed it exactly but your new RP2040 just did not respond (ie no flashing blue LED nor red xmit/Rx LEDs. I can only guess that you got a defective board out of the box. Please repost here if you get a replacement and whether it programmed properly, thanks

  9. Roger Sparry says:

    I live in Monroe GA and on 6/9/22 i flew 2000 miles to Las
    egas to pickup a 2021 Entegra motorhome, super C on a Freightline chasis.

    When I picked it up the motorhome at at NIRVC in Vegas, it was topped off with diesel fuel and DEF. I left Vegas, drove 200 miles to Flagstaff and the DEF and engine warning lights came on. I had to leave the motorhome at Freightliner in Flagstaff and fly 1800 miles back home until they could check it out.

    The problem was,before I took possession of the motorhome ar NIRVC, someone put diesel in the DEF tank and ruined the system. NIRVC will pay for repairs, but I have been waiting for parts for over 2 months with no indication when the parts will be delivered to Freightliner in Flagstaff.

    Will the DEF Sensor Simulator work when the DEF system is totally inoperable? Any advice greatly appreciated.

    Regards,
    Roger

    • Archer2 says:

      Wow! I’m sorry for your misfortune and I hope all works out in the end. You do pose an interesting question though. First, the fact that you drove a couple of hundred miles before any sight of a problem is weird. The DEF ‘quality’ sensor should act almost instantly in reporting that the specific gravity of the fluid in the tank was out of tolerance. The only thing that might make sense is if the tank had enough real DEF in it that was at the bottom of the tank and the Diesel fuel was floating on top. The quality sensor is located are the very bottom of the DEF sensor assembly as is the DEF pickup and it might just have took a while for the Diesel to get down to it as the DEF was used.
      Your other question is more complicated. If the DSS was installed then it would send info indicating that the DEF was normal at 32.5% urea. So, it wouldn’t generate any faults itself. However I don’t know how the remaining sensors in the system like the NOx sensors, the reaction chamber temperature sensors, the ammonia ‘slip’ semsors etc would react to raw diesel actually being injected into the exhaust. But then again, some amount of unburned diesel has to be present anyway normally, right? And the amount of fluid being sprayed out of the DEF injector is also very small. So the bottom line is I don’t know exactly what might happen.

  10. Roger Sparry says:

    Thanks for your reply. Sounds like I would be taking a chance of creating additional problems; don’t need that. Just looking for some workaround to get it back to Monroe.

  11. Dennis Dodd says:

    I just assembled the CANBed RP2040 per your instructions and tried to download the software. Did the copy and paste and the Windows Explorer window closed per your instructions. The software only took about 3 seconds to download and I never saw activity lights but the window did close. My “programmed” board looks just like your example, the Green LED next to the USB port is on, the Blue LED is flashing and the two Red LEDs on the bottom are lit and Steady. Does this sound normal, is there anyway to test other than plug into the coach sensor circuit? Thanks for all of the help.

  12. Good Morning,
    I built the DEF Simulator and it worked perfectly, got me 3000 miles down the road and home. Thank you very much for the information and support. When I got home I unplugged my DEF Sim from the coach, and re-connected the defective head thinking I could get a mobile technician to replace my defective DEF head. That didn’t, and hasn’t happened. I disconnected the defective head, and re-connected my DEF Sim and started the coach. The original error codes returned and they are now “flashing” on and off on my dashboard. Any suggestions?

    • Archer2 says:

      Hi Jeff. First, congratulations on being able to get home safely by using the DSS you built.
      As to your question though, I suspect that if you follow the procedure to force the ECM to clear stored codes by starting the engine and allowing it to run for 5 minutes and then repeat 3X total, the stored codes should clear.

  13. Gilbert Weiner says:

    You indicate that I need “an ohm meter (multi-meter) to determine which wire is connected to which pin.” Can you explain further how that is done? Thanks.

    • Archer2 says:

      Sure. This step is just a final check that your wiring is correct. The issue is that there can be various kinds of connectors that can be used, for instance you may use a pre-assembled cable/connector from Diode Dynamics or you might assemble one yourself from parts. The issue is you cannot rely on the wire colors to be consistent so using an ohmmeter (also know as a multimeter or a continuity checker) to verify that each pin on your connector is, in fact, connected to the correct destination on your board.
      So for example if you are looking at the connector pins as show in the picture the pin on the upper left labeled +12V should show continuity to the screw terminal in the other picture that is also labeled +12V. Same for the pin on the upper right labeled CAN L, etc. you should also check that you Don not have a short-circuit from any wire to the other three wires.
      If you used a Diode Dynamics cable/connector assembly but don’t have an ohmmeter you are probably safe just verifying that the wire colors at the board end match the ones in the pictures here.

  14. Spike says:

    Any chance of this working on heavy equipment? Running j1939 and has the same 4 pin DT harness connections for def header.

    • Archer2 says:

      You won’t know for sure until you try it, but yeah. I would say that there’s a 99.9% chance that it will work, especially if the unit has a CM2350 ECM. Let us know if you try it & whether it worked.

  15. Ricker Goldsborough says:

    Thank you all for this needed tool (assembly). I am building two of them. One for myself and one that I can send out to stranded individuals. Freightliner Chassis with Cummins ISB6.7 engine (2013).
    Used the CanBed RP2040 from Digitec and have successfully programmed both cards.
    Question is, where do I splice in or install connectors if I can not find the correct connector? What I find is a flat connector near the DEF header that has 5 wires in it and a smaller 2 wire connector. However, the header unit only has 4 flat spades where the 5 wire connector connects to it.
    Am I to use a meter to figure out if the flat connector has the 12+, Neg, Can-L and Can-H? If so, what typ of signals would I be looking for on the Can-L & -H pins? Would the power need to be on and/or engine running?

    • Archer2 says:

      I am afraid that I’m going to not make you happy. The DSS is only for engines made in 2016 and later that mark when the EPA began requiring a DEF “Quality” sensor to measure the specific gravity of the fluid along with the Temp and the Level. This info is on this page in the website https://defsim.myervin.com/cummins-engine-compatibility.
      The problem is not just that your coach uses a different connector but it is that your coach used an analog sensor system so the DSS (being a digital device communicating on the J1939 Data Network) is fundamentally incompatible.
      The good news though is the analog sensors are much less prone to failure so you will not likely ever have to deal with a DEF sensor problem. Also your plan to have a spare to offer to others in emergency need is truly admirable. If you want to use this forum to let others know that you have a couple of already-built units available to sell to cover your component costs please feel free.

      • Ricker Goldsborough says:

        Thank you Archer2 for your reply.
        I have two units available for someone to purchase or use. If you are stranded and in need of the DSS, you can contact me with your shipping address and I will send one right out. When you are finished with it I ask that you return it for others to use or you can purchase it for $100.00.

  16. Ricker Goldsborough says:

    I have DSS (CanBed RP2040) units programmed and ready to overnight to anyone in need.
    Please email me.

  17. Edward Medina says:

    Hi Archer-
    After following and performing step 4. I can get the new window to open or can be found manually. I am not getting and errors on Window 7 Ultimate with service pack 1 64 bit operating system. Power LED lights up and the activity LED blinks 3 or 4 times before following step 4. Wounding what can be the issue.

  18. Edward Medina says:

    Sorry typo error, I can not get new window to open. Using Longan canned Rp2040-can bus development board.
    Thanks

Leave a Reply

Your email address will not be published.

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