1
\$\begingroup\$

I currently work on a sensorbox which needs to measure analog signals (temperature, power consumption,..), digital signals (magnetic contacts, positions,...) and control digital switches (relays). All this magic is controlled by a PIC18F (has an ADC) and interfaced with a larger machine via CAN. This is just a laboratory setup (lots of cables, breadboard), where the controller is programmed using ICSP.

Since the box should now be included in the machine I was wondering how to include the MCU, since the sensors are almost unreachable after the project is finished.

  1. Wire all the cables from the sensorbox to a 'safe' location where the MCU is located
  2. Include the MCU on the box and wire only the CAN to the frontend

Since I am not sure that I have to change the code I would prefer option 1. Here I can reprogram the MCU on the front.

OR

Wire additional cables (the three programmer cables for the MCU) to the frontend.

Whats the conventional method for such a problem?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Could you consider bootloading via CAN? That'll help alleviate your reprogramming problem. \$\endgroup\$ Commented Nov 25, 2019 at 12:57
  • \$\begingroup\$ Yes and No. I found this thread on the MCP forum microchip.com/forums/m900339.aspx where I need to program my own bootloader and make CAN input accessible. I think I am not ready for such an undertaking \$\endgroup\$
    – v3xX
    Commented Nov 25, 2019 at 13:00
  • \$\begingroup\$ What is a "box" and why isn't it "safe"? Safe from what? EMI? Water? The customer's clumsy fingers? Raging bears? \$\endgroup\$
    – Lundin
    Commented Nov 25, 2019 at 14:41

1 Answer 1

1
\$\begingroup\$

Issues regarding option 1, in case you've not considered them yet:

  • The biggest issues I think would be interference/noise/reflections on the cabling. You could end up with some very squiffy readings unless you ensure proper isolation/filtering (depending on the signals).
  • The extra cabling increases both the BOM cost and the production time/cost.

My personal view would be that it need only be the communications (and power?) cabling between the main device and the sensor box. This way, you make the sensor box functionally independent and more importantly - completely replaceable.

With a bootloader on the MCU, you should even be able to reprogram it via the comms link.

If you can't get a bootloader though, then the next best alternative would be to have an externally-accessible header on the sensor box.

\$\endgroup\$
6
  • \$\begingroup\$ Option 1: Consists of N data cables, +5V and Vdd, but also needs two separate PCBs (1 on the box and 1 at the front interfacing with the machine. \$\endgroup\$
    – v3xX
    Commented Nov 25, 2019 at 13:39
  • \$\begingroup\$ Since the header for the cables are also built by me I would bundle the datacables with with shielding and separate the power cables (twisted Vcc,Vss). \$\endgroup\$
    – v3xX
    Commented Nov 25, 2019 at 13:43
  • \$\begingroup\$ Also, I can ignore time and cost in this situation \$\endgroup\$
    – v3xX
    Commented Nov 25, 2019 at 13:45
  • \$\begingroup\$ It still sounds a lot easier to just have all the sensors and the MCU on one board, then just CAN/power between it and the main device. Then just have a separate (easily-accessible) connector which you can plug the ICD/PICKit to. \$\endgroup\$ Commented Nov 25, 2019 at 14:16
  • \$\begingroup\$ To summarize: 1 CAN-Cable (shielded), Twisted Power cable and shielded Programmer-Cable. I have to test the stable length of the Programmer-Cable. The real distance ~3m \$\endgroup\$
    – v3xX
    Commented Nov 25, 2019 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.