So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By JeffT
#67064 My background is programming not electronics. I have a handle on how microprocessors operate.

I have to find a solution to a current situation. I have a sensor which puts out an analogue signal varying between 1.5 and 5 volts. I want to send it to a device but somehow drop the voltage so that it appears 1v lower than the signal sent. i.e. if it is actually sending 2.5v I want it to be converted to 1.5v, 3.5v to 2.5v etc.

I thought of using an arduino - sending the original signal to an analogue input pin - reading the value and converting it with a couple of lines of code - then putting it out to a PWM pin as the desired value.

I suspect this is a dumb way of doing it and there is a much simpler method that does not involve using a microprocessor.

Can anyone tell me what that method is :?:

thanks in advance
User avatar
By rudy
#67079 The ESP8266 has one analog pin (as stated above) and it has pwm output capability just like other Arduinos. Same code will work. The range of the pwm output is 0-1023. The one problem with the A0 analog input is that it has some noise.

https://github.com/esp8266/Arduino/issues/2070