I am trying to implement a temperature control system in an Arduino and I also want to know relevant parameters such as settling time, overshoot, etc., so I want to give a unit step input to the Arduino.
I have two questions:
I am confused about how to give a unit step input to the Arduino and through which pins (analog input or digital input).
I have also attached snapshots of the Tinkercad simulator. I am unable to find any option related to a step signal, so how can I can give a step input to the Arduino? (I think we can use a square wave but I don't know how to convert a square wave into a unit step.)
2 Answers 2
It sounds like you are trying to implement a PID controller with the Arduino.
You would normally apply the unit step to the plant (the system to be controlled.) From the settling time and overshoot, etc. you would then calculate the parameters for the PID controller. In that sense, the simulator can't help you much - you have to apply a step change to some real life parameter (in your case, the temperature) then observe the change in the real system.
If you are trying to measure the response of the PID controller you have already implemented on the Arduino, then you would apply the unit step to the same input as you are using for the PID controller. That would normally be an analog input, though it may be provided digitally by an analog to digital converter.
I don't see any ready made components in Tinkercad to generate a voltage step. You would have to put together a circuit in Tinkercad to generate the voltage step. You could use the simulated Arduino and a bit of program code to make the step.
Something like this:
schematic
simulate this circuit – Schematic created using CircuitLab
You start your program with the digital output set to 0V, then switch it to 5V after a short period. The values of the three resistors will determine what voltage you have when the digital output is high or low. The analog input goes into your PID input. You would monitor the PID output using the oscilloscope function in Tinkercad.
An alternative to @JRE's solution is to change the setpoint rather than the temperature feedback. I can think of several ways of doing this in real life but not sure which would be easiest in TinkerCAD.
- Adjust the setpoint using the serial interface.
- Use a digital input. If low, then use the setpoint unaltered. If high, then add an offset (which can be postitive or negative) to the setpoint.
- Use an analog input and add the scaled input value to your setpoint. You could combine this with a digital input if you needed to switch between addition and subtraction.
You can then test the reaction to a step change in setpoint.
Explore related questions
See similar questions with these tags.