OK to connect voltage to Analog input without ground?

Hi there!

I have a circuit which connects:
A0 to phototransistor to 33 ohm resistor to 3.3 V

It works great, the A0 reading goes from 500 to 1023 when I shine light on the phototransistor.

I am just wondering, is this OK or do I need to also connect to ground? This functionality is exactly what I want, but I don't want to start any fires or burn out my circuit.

Thanks for your advice!

Why 33 ohm resistor?

I suggest (with A0 as in input):

I agree with Archibald. Your circuit is only working due to luck. Shift the temperature, add a little noise, or use a different phototransistor and it will quit working.

I am truly amazed that that works often enough for you to feel it is usable; I would expect it to be plagued by false positives... something must be discharging the s/h capacitor in the adc between reads (are you reading something else? that would explain that bit), and that's how it's getting back down to ~Vcc/2 when there's no light. a 10k ohm resistor as suggested between the input and ground would give you a much more robust circuit (and you could use any input, not just analog ones).

I also recommend the circuit archibald posted (the 33 ohm resistor you used is harmless, but also useless).

Thank you all very much for the advice!

I will switch to a 10k ohm resistor and use the recommended circuit. I had a feeling I was just getting lucky with the existing circuit.

Really appreciate it!