-
Arduino Issue: Multi Sensor (different ranges) = Multi VReferences?
09/14/2016 at 20:58 • 0 commentsThank your follows. Perhaps one of you could help me with one of my technical issues.
My Multi Sensor Question on Arduino Forum
Here is the text of my problem/question I posted to the above forum:
I'm working on a project requiring more than one analog sensor. A 0v to 1v LM35 temp sensor and since my project is portable and on battery power, the 1S LiPo voltage (approx 3.2v to 4.2v).
So I did some reading on external and internal voltage references and how to use them to obtain more accurate readings (this article was very useful: http://blog.fiftythree.com/posts/measuring-battery-voltage).
I was thinking about using one of the cheap 0.9V-5V to 5V 600mA DC-DC Step-Up Boost Converter boards (they look like: Picture link to power my Arduino from the battery to give me a solid 5 volts. I'm guessing I could also use this as an external voltage reference (into AREF pin). This would then workout nicely for my battery measurements.
But what about the LM35? It wants a lower voltage reference if I want accuracy. Can you switch references (internal/external) and measure each value separately? Or do I need to bring down my LiPo voltage via voltage divider so both use same fixed VRef? (aka lowest common denominator). -
Programming The User Interface
09/13/2016 at 20:16 • 0 commentsLet's talk about programming the user interface and how I want my light to work when I only have essentially a power switch and a on/off touch sensor available. How do you control multiple items using just one "button"? Read on and I'll tell you.
On startup, the first thing I thought was like a car when you first start it and all the lights go on. I'm thinking the same thing. Of course after setting up the pins for the I/O I want. Turn on 10W lamp, EL wire, and all three RGB LED colors for all addressable lights for 2 seconds and then alternate 3 primary colors on RGB LEDs, 1 second each.
Then on to setup mode. But first, read battery voltage and somehow map to color bar perhaps weighed more to the front of the bike where I can see the addressable LEDs better. Maybe just the first 10 LEDs. The display would also be more useful skewed to show a 3v to 4v range because you don't want to deplete the LiPo any lower (and I also plan on monitoring and gracefully shutting down when the voltage gets too low).
While the battery level is shown on the addressable LEDs, the EL wire would "blink" off and back on to indicate that we are setting it up. My thought was to go into a loop for 5 seconds. If no capacitive touch, blink once more and go on. If the metal housing is touched, the EL wire state would toggle on to off or vice versa and restart the 5 second timer. So leave it alone if you like its current state, otherwise touch the lamp to change it. The initial and final blink indicate the entering and exiting of the EL wire setup. Always think about having your device give you feedback when trying to control it.
On to the main lamp. Again, quick flash to indicate enter and exit and with a 5 second timeout. For the lamp though I'm thinking as long as you are touching the lamp, the brightness would slowly ramp up and down including a brief pause while off. Remove your finger and the lamp would stay at that brightness. Wait 5 seconds and the setting sticks.
Finally, the addressable LEDs. I've done a pair of the neopixel glasses that I programming with multiple modes with just one button using long and short "clicks". I thought about using similar techniques here to alternate and pick the display mode and or color. But I've found just having a random changer between modes/colors works best.
After the setup I'm thinking that the only control you would want or need would be LED brightness in a similar way as the setup. Otherwise, you could just toggle the power if you wanted to turn the EL wire off, but leave the headlight on for example.