Simulink for Mechanical & Electrical Engineers Challenges = Week 2
- Aim
- To Make a Simulink model of Doorbell using solenoid block.
- To Use a thermistor to sense the temperature of a heater & turn on or turn off the fan according to temperature.
- Questions & Solution
- Q1. Make a Simulink model of Doorbell using a solenoid block with the following details:

- In the above arrangement, when the switch is closed the electromagnet receives electrical power from the battery and pulls the metal arm to hit the bell producing sound.
- Create a situation where the switch is closed for 2 seconds and then released. Observe the physical movement of the plunger.
- Assume remaining parameters.
- Solution 1.
- Theory :
- The circuit of the door bell using a solenoid block is as shown in the above figure.
- When we close the switch we complete the circuit then the electric current is flown through the circuit.
- After that, the electromagnet gets charged, and then it acts like a magnet due to which it pulls the nears metal clip towards it.
- As the metal clip moves towards the magnet, the extended part of the metal clip hits the gong and creates the sound.
- Which we refer to as the sound of a bell.
- Following is the simulation model for Door Bell using a solenoid block.

- In the above model the simulation blocks used & their purpose are as follows :
- Pulse Generator - The Pulse Generator block generates square wave pulses at regular intervals. The block waveform parameters, Amplitude, Pulse Width, Period, and Phase delay, determine the shape of the output waveform.
- Scope - Display signals generated during simulation.
- Simulink-PS converter - Converts the Simulink input signal to a Physical Signal.
- SPST Switch (Single-pole single-throw switch) - The block represents a Single-Pole Single-Throw (SPST) switch controlled by an external control signal vT. If vT is greater than the threshold, then the switch is closed, otherwise, the switch is open.
- Battery – It is a stored electrical source for the electrical circuit.
- Electrical Reference - The Electrical Reference block represents an electrical ground.
- Solenoid - The Solenoid block represents the electrical characteristics and generated force for the solenoid. This solenoid block represents Port R moves towards port C.
- Mechanical Translational Reference - The Mechanical Translational Reference block represents a reference point, or frame, for all mechanical translational ports.
- Solver Configuration - The Solver Configuration block specifies the solver parameters that your model needs before you can begin the simulation.
- Ideal Motion Translational Sensor – It acts as a Motion sensor in mechanical translational systems. The Ideal Translational Motion Sensor block represents a device that converts an across variable measured between two mechanical translational nodes into a control signal proportional to velocity or position. You can specify the initial position (offset) as a block parameter.
- PS-Simulink Converter - Converts the input Physical Signal to a Simulink output signal.
- Working of Model
- Pulse Generator creates an input signal of pulse with 1 unit amplitude, 4 sec period, having 50% pulse width with 2-sec delay for the model.
- Then we attach the scope to it get so that we can compare the inputs and outputs of the model.
- Now the input signal is connected to the Simulink-PS Converter which converts the Simulink signal to a physical signal which is then sent towards the SPST switch.
- After receiving the physical signal, the SPST switch compares it with its threshold value if it's greater than it, then it closes the electric circuit, or else it is open.
- After the electric circuit is closed the current is flown from the circuit and then it energies the solenoid connected to the battery.
- As the solenoid is charged it pulls the Port R towards port C (which refers to us as the ringing of a bell).
- A Mechanical Translation Reference is attached to the port R of the Solenoid to understand the position and velocity of the plunger of the solenoid.
- To record its position and velocity PS-Converter converts the physical signal to a Simulink signal and then using the scope block we record it for the simulation duration.
- Results
- Pulse Value VS Time

- Position VS Time

- Velocity VS Time

- Q2. Use a thermistor to sense the temperature of a heater & turn on or turn off the fan as per the below conditions:
- Temperature source: 20 °C from 0 to 10 seconds, 27 °C from 10 to 30 seconds, 23 °C from 30 to 50 seconds.
- Fan conditions: ON if the temperature above 25 °C, OFF otherwise.
- Solution 2.
- Theory
- A thermistor is a type of resistor whose resistance is strongly dependent on temperature, more so than in standard resistors. The word is a combination of thermal and resistor. Thermistors are widely used as inrush current limiters, temperature sensors (negative temperature coefficient or NTC type typically), self-resetting overcurrent protectors, and self-regulating heating elements (positive temperature coefficient or PTC type typically).
- Thermistors are of two opposite fundamental types:
- With NTC thermistors, resistance decreases as temperature rises usually due to an increase in conduction electrons bumped up by thermal agitation from the valency band. An NTC is commonly used as a temperature sensor, or in series with a circuit as an inrush current limiter.
- With PTC thermistors, resistance increases as temperature rises usually due to increased thermal lattice agitations particularly those of impurities and imperfections. PTC thermistors are commonly installed in series with a circuit and used to protect against overcurrent conditions, as resettable fuses.


- Following is the simulation model for using a thermistor to sense the temperature of a heater & turn on or turn off the fan as per conditions.

- In the above model the simulation blocks used & their purpose are as follows :
- Controlled Temperature Source – The Controlled Temperature Source block represents an ideal source of thermal energy that is powerful enough to maintain specified temperature differences across the source regardless of the heat flow consumed by the system.
- Thermistor – The Thermistor block represents an NTC thermistor using the B-parameter equation. The resistance at temperature T is R=R0⋅eB(1T−1T0)..
- Resistor – The Resistor block represents a linear resistor.
- Voltage Sensor – The Voltage Sensor block represents an ideal voltage sensor, that is, a device that converts voltage measured between two points of an electrical circuit into a physical signal proportional to the voltage.
- Battery – The Battery block represents a simple battery model.
- SPST Switch – The block represents a Single-Pole Single-Throw (SPST) switch controlled by an external control signal vT. If vT is greater than the threshold, then the switch is closed, otherwise, the switch is open.
- Electrical Reference – The Electrical Reference block represents an electrical ground.
- Universal Motor – The Universal Motor block represents the electrical and torque characteristics of a universal (or series) motor.
- Mechanical Rotational Reference – The Mechanical Rotational Reference block represents a reference point, or frame, for all mechanical rotational ports.
- Ideal Rotational Motion Sensor – The Ideal Rotational Motion Sensor block represents an ideal mechanical rotational motion sensor, that is, a device that converts an across variable measured between two mechanical rotational nodes into a control signal proportional to angular velocity or angle.
- Solver Configuration – The Solver Configuration block specifies the solver parameters that your model needs before you can begin the simulation.
- PS-Simulink Converter – Converts the input Physical Signal to a Simulink output signal.
- Scope – Display signals generated during simulation.
- From – The From block accepts a signal from a corresponding Goto block, then passes it as output. The data type of the output is the same as that of the input from the Goto block. From and Goto blocks allow you to pass a signal from one block to another without actually connecting them.
- Temperature Source is the Subsystem block which is as follows.

- Constant – The Constant block generates a real or complex constant value signal.
- Pulse Generator – The Pulse Generator block generates square wave pulses at regular intervals. The block waveform parameters, Amplitude, Pulse Width, Period, and Phase delay, determine the shape of the output waveform.
- Product – The Product block outputs the result of multiplying two inputs: two scalars, a scalar, and a nonscalar, or two nonscalars that have the same dimensions.
- Add – The Sum block performs addition or subtraction on its inputs.
- Scope – Display signals generated during simulation.
- Goto – The Goto block passes its input to its corresponding From blocks. The input can be a real- or complex-valued signal or vector of any data type. From and Goto blocks allow you to pass a signal from one block to another without actually connecting them.
- Simulink-PS converter - Converts the Simulink input signal to a Physical Signal.
- Thermal Input – It is an output of this subsystem that is connected to the Controlled Temperature source in the main model.
- Working of Subsystem Model
- According to the given conditions we need to build the temperature source 20 °C from 0 to 10 seconds, 27 °C from 10 to 30 seconds, 23 °C from 30 to 50 seconds.
- So we use the constant block to provide three constant temperature, then we need to specify its duration so we create the pulse block which has 1 unit amplitude 50 sec period 20% & 40% pulse width and with 0 sec, 10 sec, and 30 sec delay for respectively pulse generator.
- Then we take the products of constants and their respective pulse generator.
- By adding them we create the signal needed according to the given conditions.
- And we add another constant value 273.15 which converts deg Celsius value to deg Kelvin.
- Further, a ‘Goto’ block is connected to the ‘Add’ block which transfers the same signal to the ‘From’ block.
- The signal from the ‘Add’ block is connected to the Simulink-PS converter and then it is further sent as the output signal of this subsystem model.
- Working of the Model.
- The temperature source subsystem model provides the temperature to the Controlled Temperature Source, according to the inputs it provides the surrounding temperature condition to the thermostat.
- The thermostat is connected in a closed circuit with a battery and a resistor connected in a series combination with it.
- As the temperature increases the thermostat resistance value decreases and the overall current in the circuit increases, which leads to an increase in the voltage around the resistor of 10 ohms.
- We note the Voltage around the resistor when the temperature is about 25 deg Celsius which is 2.273 V
- By using the PS-Simulink converter we convert a physical signal from the voltage sensor into a Simulink signal and record it using a scope block to understand how voltage varies with Temperature.
- The Voltage sensor signal is also sent to SPST whose threshold value is 2.273 V, i.e. when the temperature goes above 25 deg Celsius the SPST switch is closed & completes the circuit.
- As the universal motor is connected in series with the SPST switch and to the battery, it gets on only when the temperature is above 25 deg Celsius.
- To verify the outcome of the Universal motor we have attached the Ideal Rotational Motion Sensor to it.
- Now the PS-Simulink converter converts the physical signal from the rotational sensor and converts it into a Simulink signal which is then used to record the angular velocity and angle of the Universal Motor.
- Results
- Temperature VS Time

- Voltage VS Time (Voltage of Resistor)

- Angular Velocity VS Time

- Angular position Vs Time

- Conclusion
- We have completed and run the model of the Doorbell using a solenoid block.
- Thus Bell is rung for every alternate 2 seconds.
- We have completed and run the model of using a thermistor to sense the temperature of a heater & turn on or turn off the fan as per conditions.
- Thus Fan is turned on only when the temperature is above 25 deg Celsius.
- We observe the little spike in voltage vs time plot of the resistor, its because we use the same battery source for the motor also since the motor is turned on and off only when the temperature is above or below 25 deg Celsius respectively these spikes can only observe during that change.