Testing software for hardware sensors without receiving data from sensors

Discussion in 'Test & Measurement Forum' started by Roby22, Mar 22, 2019.

  1. Roby22

    Thread Starter New Member

    Mar 22, 2019
    4
    0
    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!
     
  2. Yaakov

    Well-Known Member

    Jan 27, 2019
    1,422
    721
    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
     
    Roby22 likes this.
  3. jpanhalt

    Expert

    Jan 18, 2008
    7,390
    1,701
    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.
     
  4. Roby22

    Thread Starter New Member

    Mar 22, 2019
    4
    0
    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?
     
  5. ericgibbs

    Moderator

    Jan 29, 2010
    8,126
    1,643
    hi 22,
    Do you have access to a number of low spec/cost computers, say laptops.
    E
     
  6. Roby22

    Thread Starter New Member

    Mar 22, 2019
    4
    0
    I suppose that this is a question, not an answer. (I don't see any "?" in your post).
    My answer is: yes.
     
  7. ericgibbs

    Moderator

    Jan 29, 2010
    8,126
    1,643
    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: Mar 26, 2019
  8. Roby22

    Thread Starter New Member

    Mar 22, 2019
    4
    0
    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
     
  9. AlbertHall

    AAC Fanatic!

    Jun 4, 2014
    7,923
    1,955
    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.
     
  10. Yaakov

    Well-Known Member

    Jan 27, 2019
    1,422
    721
    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.
     
  11. ericgibbs

    Moderator

    Jan 29, 2010
    8,126
    1,643
    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: Mar 26, 2019
Loading...