Scaling Volt Readings on Gauges


#1

I could use some insight on scaling the reading on the 3 gauges reading volts. Obviously when I put 5v on the analog pin I get 1023 reading, full resolution. Using a pot I can vary the reading but I would like to scale that down to 0-60v. I was thinking that a float statement and analog read dividing 1024 to the scale I want. Racking my brain at this point. Currently the gauges are handled by Cayenne not in the sketch.


#2

Hi
I write the code for you.
What do you use for connecting to the cayenne (Arduino + Ethernet, Serial + Arduino)?


#3

I’m using Arduino+Ethernet w5100 for now. Wifi will come later(ESP-12E)

Thanks!


#4

Voltage 0-60V.txt (802 Bytes)


#5

Awesome!!! Thanks!!


#7

In the code, you have a few bugs.
I’ll rewrite it.


#8

Try this

voltege.txt (2.8 KB)


#9

Thanks! That worked perfectly. Only thing I had to do was change some settings from digital to virtual as cayenne was taking care of those functions without the need of code. With people like you I am learning more and more about coding, it has been a difficult road. Now I can add more voltage inputs in the future.

Thanks Again! You Rock!