Testing software for hardware sensors without receiving data from sensors

Thread Starter

Roby22

Joined Mar 22, 2019
4
Hello guys,

I have a microcontroller integrated in a ECU and this ECU is connected to some external inputs (temperature sensors, high voltage sources, etc). I want to develop a software for processing these inputs from the sensors. After I will develop the software, I want to test the developed software - software requirement tests. The main problem of testing is that I can't create the testing conditions ( - 80 degrees, + 90 degrees, the intensity of a current of 10A, etc). I can't modify the software (.elf file) in order to make stubs for get functions for a specific sensor, in order to modify the received value from the sensor.

I want to create a hardware environment in order to give to microcontroller all possible values that it can receive from sensors, but without actually using the sensors. These sensors will be used in the final state of the project.

Do you have an idea how I can test this?

Thanks!
 

Ya’akov

Joined Jan 27, 2019
9,069
Each sensor has an output be it digital or analog (voltage, current, resistance). The program will no know if the output is coming from the actual device or something pretending to be the device.

List the sensors and their outputs, then simulate them with either variable or fixed signals that match the sensor.

For example, if a sensor’s output is usually 0-5VDC at 5mA, a small variable power supply can be the sensor for your tests. It could be a programmable one, so a second processor could change the conditions dynamically, or even the output of a DAC on an MCU.

If the sensor usually puts out a PWM signal, a small MCU can be used to create it, etc.

Sorry if this seems obvious but the level of detail in your question only allows me this answer. Other than this obvious comment, I can’t imagine what your particular problem is, there no description of the difficulties you are encountering
 

jpanhalt

Joined Jan 18, 2008
11,087
The main problem of testing is that I can't create the testing conditions ( - 80 degrees, + 90 degrees, the intensity of a current of 10A, etc).
Let's address the current first. I am not aware of any MCU that can measure 10A "directly." There must be some load on that to produce a voltage that the MCU can read. If it is reading a Hall sensor, then you need the specs for that sensor. If it is a voltage across a resistor you can easily relate current to voltage.

As for the angular input (I am assuming those are angles as in degrees of crankshaft rotation, not temperatures), what's the relationship between angle and current? How is the angle measured? For example, is it digital or pulse width?

You can simulate those inputs with any of a variety of other devices.
 

Thread Starter

Roby22

Joined Mar 22, 2019
4
The main problem is that after I will implement the software, I cannot modify it (the elf file will be kept unmodified) in order to make some stub functions for set the inputs from sensors and I also cannot use the input from sensors, but I have to test if the software is behaving correctly.
As Yakoov said, one solution would be to generate with other systems exactly the signal received by the controller from real sensors.
Another solution would be to modify the memory area where all outputs from sensor are placed. Here, the main problem is that this memory area is overwritten periodically (10ms, 100 ms, etc).
Any further ideas?
 

ericgibbs

Joined Jan 29, 2010
18,766
I would say the way my post was worded, it was obviously a question, a '?' at the end, IMO would be a questionable use of a perfectly good Space.

However, let's move on.:)

One method I often used to was to program a number of laptops is such a way they emulated the data source hardware.
Doing it that way, instead of using dedicated hardware, meant they could be programmed to create and respond in real time to the 'master' PC which I was programming.

So I would have a number of laptops outputting Range data, Depth data, Tidal data, Wave Energy data,Weather data.

E
 
Last edited:

Thread Starter

Roby22

Joined Mar 22, 2019
4
One method I often used to was to program a number of laptops is such a way they emulated the data source hardware.
Doing it that way, instead of using dedicated hardware, meant they could be programmed to create and respond in real time to the 'master' PC which I was programming.

E
Thanks for your suggestion!

Let's take one example. My uC is receiving some data from the High Voltage battery, let's say the intensity of the current (10A, 8A, 4A, 2A, 1A, etc). Based on the received value, the uC must take some decisions. For sure, the uC will receive a corresponding signal for every value of the current, which will be treated by the software.

My questions are: how can I emulate the high voltage battery using a laptop? What program shall I use?

Regards,
Roby
 

AlbertHall

Joined Jun 4, 2014
12,345
The IDE for PICs includes a simulator. You can write files for the simulator to match your external sensor data and create scenarios to see how the software reacts. I don't know what other microcontrollers have this facility.
 

Ya’akov

Joined Jan 27, 2019
9,069
You have two choices: create signals for sensors to report or create signals that look like sensors. Which is right fo your application, or easier to do, will depend on information I don't have.

If you are simulating inputs to sensors, they will have to be the same physical signals you want the sensors to see.

If you are simulating inputs to the MCU (simulating sensor outputs) they will have to be the same physical signals the sensors produce.

If you are using analog signals to an ADC, you will need a DAC that can do it. If you are using PWM signals, same idea. If you are using digital signals, you need DIO, etc.
 

ericgibbs

Joined Jan 29, 2010
18,766
My questions are: how can I emulate the high voltage battery using a laptop? What program shall I use?

How would the 'high voltage' battery be connected in the actual project.? it would not be connected directly to computer.
There must be a piece of hardware that reads the HV battery and then transmits the battery status data to the computer.

I would suggest you post a block digram showing the different data input sources and their data format, that would help us understand.

E
 
Last edited:
Top