<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Cool Wave - The Firmware</title><link>/challenges-projects/design-challenges/summer-of-green-tech-design-challenge/b/blog/posts/cool-wave---the-firmware</link><description>This blog post summarises the Cool Wave firmware. My focus for the project was to make it as accessible and extensible as possible, and this extends to the firmware. This affected my choice of language and the style of the code.
The firmware is writt</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Cool Wave - The Firmware</title><link>https://community.element14.com/challenges-projects/design-challenges/summer-of-green-tech-design-challenge/b/blog/posts/cool-wave---the-firmware</link><pubDate>Tue, 17 Oct 2023 10:01:41 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7fbbca2c-32e4-4dcf-8366-3f3acceaa669</guid><dc:creator>Alistair</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;By request, if anyone wants to copy and past the basic code on one go, then here it is.&lt;/p&gt;
&lt;p&gt;[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:ff2f9ae8-c15c-4d8b-a9c1-02912eb2caa6:type=python&amp;text=import%20time%0D%0Afrom%20machine%20import%20Pin%2C%20I2C%2C%20Timer%0D%0Afrom%20dht12%20import%20DHT12%0D%0Afrom%20dht20%20import%20DHT20%0D%0A%0D%0Ai2c%20%3D%20I2C%280%2C%20scl%3DPin%289%29%2C%20sda%3DPin%288%29%29%0D%0Adht12%20%3D%20DHT12%28i2c%2C%200x5c%29%0D%0Adht20%20%3D%20DHT20%280x38%2C%20i2c%29%0D%0Aled%20%3D%20Pin%2818%2C%20Pin.OUT%29%0D%0Arelay%20%3D%20Pin%2810%2C%20Pin.OUT%29%0D%0A%0D%0A%23%20Read%20from%20the%20DHT12%20sensor%20module%20%28outside%29%0D%0A%23%20Returned%20as%20a%20temperature%2C%20humidity%20tuplet%0D%0Adef%20readDHT12%28%29%3A%0D%0A%20%20%20%20dht12.measure%28%29%0D%0A%20%20%20%20temperature%20%3D%20dht12.temperature%28%29%0D%0A%20%20%20%20humidity%20%3D%20dht12.humidity%28%29%0D%0A%20%20%20%20return%20temperature%2C%20humidity%0D%0A%20%20%20%20%0D%0A%23%20Read%20from%20the%20DHT20%20sensor%20module%20%28inside%29%0D%0A%23%20Returned%20as%20a%20temperature%2C%20humidity%20tuplet%0D%0Adef%20readDHT20%28%29%3A%0D%0A%20%20%20%20measurements%20%3D%20dht20.measurements%0D%0A%20%20%20%20temperature%20%3D%20measurements%5B%22t%22%5D%0D%0A%20%20%20%20humidity%20%3D%20measurements%5B%22rh%22%5D%0D%0A%20%20%20%20return%20temperature%2C%20humidity%0D%0A%0D%0A%23%20Turn%20on%20or%20off%20the%20fan%0D%0A%23%20%22active%22%20is%20True%20for%20on%2C%20and%20False%20for%20off%0D%0Adef%20setFan%28active%29%3A%0D%0A%20%20%20%20relay.value%28active%29%0D%0A%0D%0AsetFan%28False%29%0D%0A%0D%0A%23%20Main%20loop%20that%20is%20executed%20once%20a%20minute%0D%0A%23%20This%20checks%20the%20inside%20and%20outside%20temperature%2C%20and%20turns%20on%20the%20fan%20if%20needed%20%0D%0Adef%20minuteLoop%28minuteTimer%29%3A%0D%0A%20%20%20%20outsideTemperature%2C%20outsideHumidity%20%3D%20readDHT12%28%29%0D%0A%20%20%20%20insideTemperature%2C%20insideHumidity%20%3D%20readDHT20%28%29%0D%0A%20%20%20%20setFan%28%20insideTemperature%20%3E%20outsideTemperature%20%29%0D%0A%0D%0A%23%20Start%20a%20timer%20that%20calls%20the%20main%20loop%20once%20a%20minute%0D%0AminuteTimer%20%3D%20Timer%28-1%29%0D%0AminuteTimer.init%28period%3D60000%2C%20mode%3DTimer.PERIODIC%2C%20callback%3DminuteLoop%29%0D%0A]&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=27018&amp;AppID=414&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Cool Wave - The Firmware</title><link>https://community.element14.com/challenges-projects/design-challenges/summer-of-green-tech-design-challenge/b/blog/posts/cool-wave---the-firmware</link><pubDate>Sun, 15 Oct 2023 16:53:31 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:7fbbca2c-32e4-4dcf-8366-3f3acceaa669</guid><dc:creator>beacon_dave</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;The temperature window will likely be a requirement early on. You could also perhaps only turn the fan on if the last &amp;#39;x&amp;#39; consecutive reads show a temperature difference in the right direction.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You could perhaps have a fire detection input option so as it shuts off in the event of a fire. You don&amp;#39;t want to pull smoke through the house or fan the flames.&amp;nbsp;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=27018&amp;AppID=414&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>