<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Use a Photoresistor From Raspberry PI To Detect Light with Python	</title>
	<atom:link href="https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/feed/" rel="self" type="application/rss+xml" />
	<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/</link>
	<description>Raspberry PI, Arduino and Electronics made simple</description>
	<lastBuildDate>Fri, 15 May 2026 13:18:09 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.1</generator>
	<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-82818</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Fri, 15 May 2026 13:18:09 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-82818</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-82813&quot;&gt;Hunter&lt;/a&gt;.

thank you for your feedback!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-82813">Hunter</a>.</p>
<p>thank you for your feedback!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Hunter		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-82813</link>

		<dc:creator><![CDATA[Hunter]]></dc:creator>
		<pubDate>Fri, 15 May 2026 12:38:37 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-82813</guid>

					<description><![CDATA[Thanks for the tip on pin_factory. My red/green led and photoresistor test was dead at 0.0 until that fix]]></description>
			<content:encoded><![CDATA[<p>Thanks for the tip on pin_factory. My red/green led and photoresistor test was dead at 0.0 until that fix</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-16574</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Mon, 04 Jul 2022 10:20:50 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-16574</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-16293&quot;&gt;Mohammad&lt;/a&gt;.

Sorry for the late reply and thank you very much for your feedback, Mohammad!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-16293">Mohammad</a>.</p>
<p>Sorry for the late reply and thank you very much for your feedback, Mohammad!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mohammad		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-16293</link>

		<dc:creator><![CDATA[Mohammad]]></dc:creator>
		<pubDate>Tue, 21 Jun 2022 14:24:45 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-16293</guid>

					<description><![CDATA[You better to select resistor 100K based on photo resistor resistance. I added a potentiometer to adjust the sensitivity. I used a 30K resistor instead of 100K in series with a 100K potentiometer. Now it works well. For raspberry pi zero, logic level low is less than 1.4V.
Thanks for your information.]]></description>
			<content:encoded><![CDATA[<p>You better to select resistor 100K based on photo resistor resistance. I added a potentiometer to adjust the sensitivity. I used a 30K resistor instead of 100K in series with a 100K potentiometer. Now it works well. For raspberry pi zero, logic level low is less than 1.4V.<br />
Thanks for your information.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: peppe8o		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-14261</link>

		<dc:creator><![CDATA[peppe8o]]></dc:creator>
		<pubDate>Sat, 30 Apr 2022 12:12:41 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-14261</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-14140&quot;&gt;Jon&lt;/a&gt;.

Hi Jon
you must combine my python code with the following:

&lt;code&gt;from datetime import datetime&lt;/code&gt;
&lt;code&gt;&lt;/code&gt;
&lt;code&gt;f = open(r&quot;path_to_file.txt&quot;,&quot;a&quot;)&lt;/code&gt; # opens the file (a=append, w=write, r=read)
&lt;code&gt;&lt;/code&gt;
&lt;code&gt;now = datetime.now()&lt;/code&gt; # current date and time
&lt;code&gt;date_time = now.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)&lt;/code&gt; #this formats the datetime
&lt;code&gt;f.write(date_time+str(GPIO.input(readPIN))+&quot;\n&quot;)&lt;/code&gt; # the final \n adds a carriage return
&lt;code&gt;&lt;/code&gt;
&lt;code&gt;f.close()&lt;/code&gt; # close the file

The first import goes at the beginning of code.
The f.open() goes just after importing the libraries.
The third part goes in the &quot;while True:&quot; loop.
The f.close() goes in the &quot;except KeyboardInterrupt:&quot; part.

Please let me know if this works.
Giuseppe]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-14140">Jon</a>.</p>
<p>Hi Jon<br />
you must combine my python code with the following:</p>
<p><code>from datetime import datetime</code><br />
<code></code><br />
<code>f = open(r"path_to_file.txt","a")</code> # opens the file (a=append, w=write, r=read)<br />
<code></code><br />
<code>now = datetime.now()</code> # current date and time<br />
<code>date_time = now.strftime("%Y-%m-%d %H:%M:%S")</code> #this formats the datetime<br />
<code>f.write(date_time+str(GPIO.input(readPIN))+"\n")</code> # the final \n adds a carriage return<br />
<code></code><br />
<code>f.close()</code> # close the file</p>
<p>The first import goes at the beginning of code.<br />
The f.open() goes just after importing the libraries.<br />
The third part goes in the &#8220;while True:&#8221; loop.<br />
The f.close() goes in the &#8220;except KeyboardInterrupt:&#8221; part.</p>
<p>Please let me know if this works.<br />
Giuseppe</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jon		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-14140</link>

		<dc:creator><![CDATA[Jon]]></dc:creator>
		<pubDate>Mon, 25 Apr 2022 19:39:40 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-14140</guid>

					<description><![CDATA[Any hints for a python noob... Would like to adapt your script to write output to a log file. Log file entries would only be written when the state changes (from 0 &#062; 1, and from 1 &#062; 0). Plus... entries have to be timestamped. (Am monitoring a thermostat&#039;s LED indicator.) So, log file would look something like:
2022-04-25 20:36:07 1
2022-04-25 20:41:39 0
2022-04-25 20:57:19 1
...]]></description>
			<content:encoded><![CDATA[<p>Any hints for a python noob&#8230; Would like to adapt your script to write output to a log file. Log file entries would only be written when the state changes (from 0 &gt; 1, and from 1 &gt; 0). Plus&#8230; entries have to be timestamped. (Am monitoring a thermostat&#8217;s LED indicator.) So, log file would look something like:<br />
2022-04-25 20:36:07 1<br />
2022-04-25 20:41:39 0<br />
2022-04-25 20:57:19 1<br />
&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: N		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-3313</link>

		<dc:creator><![CDATA[N]]></dc:creator>
		<pubDate>Fri, 23 Apr 2021 23:21:58 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-3313</guid>

					<description><![CDATA[Now I see. The Led was the reason. Everything works now.]]></description>
			<content:encoded><![CDATA[<p>Now I see. The Led was the reason. Everything works now.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: N		</title>
		<link>https://peppe8o.com/using-photoresistor-from-raspberry-pi-to-detect-light/#comment-3312</link>

		<dc:creator><![CDATA[N]]></dc:creator>
		<pubDate>Fri, 23 Apr 2021 23:05:29 +0000</pubDate>
		<guid isPermaLink="false">https://peppe8o.com/?p=1998#comment-3312</guid>

					<description><![CDATA[Unfortunately I always get state 1, even though a LED after transistors shows there is a current when it is dark. But it&#039;s impossible to get voltage small enough on pin 14 with these resistors...]]></description>
			<content:encoded><![CDATA[<p>Unfortunately I always get state 1, even though a LED after transistors shows there is a current when it is dark. But it&#8217;s impossible to get voltage small enough on pin 14 with these resistors&#8230;</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
