#1 2019-02-28 07:46:55

mikeyh
Member
From: New Zealand
Registered: 2016-04-28
Posts: 44

HIL Simulation using SPI Digital POTS

Hi All,

I'm going to do some HIL simulation on some hardware. Using REX I'm going to run a model to feed back to the hardware I'm testing. I need to use digital POTs as the hardware uses NTC probes for temperature measurements. The digital POTs have SPI so that means coding in REXLANG!

I'm going to use the MCP414X/416X/424X/426X series of POTs, has anyone here had experience coding REXLANG for these? The added kicker is I need to use the dual POT chips as I need 4 analogue inputs and the RPI only has 2 SPI out pins. Could this complicate it?

Data sheet link for those interested, http://ww1.microchip.com/downloads/en/D … 22059b.pdf

Cheers

Mike

Offline

#2 2019-03-01 14:52:32

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 535

Re: HIL Simulation using SPI Digital POTS

Hi Mike,
awesome project!

I have used DS1844, it has 4 channels and I2C bus. Have you considered it?

If you are forced to use the MCP414X/416X/424X/426X, it should work via REXLANG as you wrote. The 1-channel and 2-channel versions typically use the same communication, only with one additional byte for the 2-channel version. No complication at all, I dare to say.

Kind regards,
Jaroslav

Offline

#3 2019-03-04 09:38:16

mikeyh
Member
From: New Zealand
Registered: 2016-04-28
Posts: 44

Re: HIL Simulation using SPI Digital POTS

Hi Jaroslav,

Yes it will be an interesting project for sure. I only picked the MCP series due to having 8 bit and 256 steps. I do think the I2C of the DS1844 is worth considering though. I need good resolution to cover the NTC range I am trying to replicate, -27°C (100K) to +80°C (1.7K)

Cheers

Mike

Offline

#4 2019-03-04 09:53:50

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 535

Re: HIL Simulation using SPI Digital POTS

Hi Mike,
the DS1844 only has 64 positions. If resolution is the primary concern, the MCP series definitely fit beter.

Jaroslav

Offline

#5 2019-03-05 20:20:53

mikeyh
Member
From: New Zealand
Registered: 2016-04-28
Posts: 44

Re: HIL Simulation using SPI Digital POTS

I'm just trying to confirm hardware for this project. As the Monarco uses the SPI and I2C I will have to use a plain RPi with no hat. Do you have an example of RS485 over USB for the RPi?

The RS485 will provide me with feed back as to what the hardware I'm testing thinks it should be doing! i.e temperature, alarm and status feedback.

Thanks in advance

Mike

Offline

#6 2019-03-07 16:10:50

jaroslav_sobota
Administrator
Registered: 2015-10-27
Posts: 535

Re: HIL Simulation using SPI Digital POTS

Hi Mike,
you can use example 0501-01 (generic serial communication) or any of the 0401-xx examples on Modbus RTU communication. The USB RS485 adapter will appear as e.g. /dev/ttyUSB0, which you will use as the identifier of the serial bus.

I have the best experience with FTDI-based USB adapters. With other brands I sometimes had problems changing the baudrate.

Kind regards,
Jaroslav

Offline

Board footer

Powered by FluxBB