Voltage drop affects sensor reading

microcontroller

I have a design project which is an infant incubator. This design consists of Fujitsu's MCU MB90f387s, a potentiometer (for input temperature), HSM20-G (analog temperature and humidity sensor), 2 bulbs, LCD, FAN and relay. I am using ADC of the MCU for the sensor and potentiometer.

The flow of the system is:

  1. read the input temperature
  2. on the bulb or fan until the sensor reads temperature similar to the input temperature.
  3. off the bulb or fan.

The problem is when the MCU turns the relay on (turning on the fan or bulb), there is a voltage drop in the power supply which makes the sensor and the potentiometer's data(reading) change.

A scenario:
Initially, bulb1 off, bulb2 off, fan off

  1. input = 33C, sensor reading 29C
  2. bulb1 and bulb2 on, voltage drops .6V, input reading 30C, sensor reading 25C
  3. sensor reading 27C, bulb1 on, bulb2 off, supply voltage gains .3V, input reading 31C, sensor reading 26C

Explanation:
whenever the mcu turn the bulb on, an amount of voltage drops, if the mcu turn on the other bulb, another voltage drop.

Question:
What is the solution so that the sensor and the input temperature have consistent reading?
i already read this, from arduino forum. Giving another supply (cellphone charger) to the sensor or relay makes the sensor/relay not work.

Please shed me some light about this. thank you.

Best Answer

I asked here because its been 3 days solving this problem. Finally i got a solution.

The arduino forum which is included in my post has a solution for the problem but didnt solve mine. There is an answer to separate the GND pin of the relay to another GND pin in arduino but this doesn't solve my problem. What i did is separate both GND pin and VCC pin in the MB90F387s. That solved my problem. Thanks for everybody who wants to help.