tag:blogger.com,1999:blog-44559870880086225362024-03-11T20:38:46.039+00:00Gadjet's BlogThings I get up toGadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.comBlogger81125tag:blogger.com,1999:blog-4455987088008622536.post-24370131282431860312022-06-04T17:27:00.002+01:002022-06-04T17:39:39.704+01:00Three button WiFi Remote<p style="text-align: left;"><span style="font-family: verdana;">Using the power control circuit from the Wirelesse door/Window sensor I have designed a simple 3 button WiFi remote with the intention of controlling a couple of WiFi Switches for my TV and a Lamp.</span></p><p style="text-align: left;"><span style="font-family: verdana;">Currently I'm using an aging 433MHz system which is slowly wearing out due to years of usage.</span></p><p style="text-align: left;"><span style="font-family: verdana;">I realise there are many off the shelf solutions out there that I could buy and use but it wouldn't be as much fun as doing it myself although it would probably be alot quicker!</span></p><p style="text-align: left;"><span style="font-family: verdana;">The basic principle of the supply circuit is that the LDO's enable pin is controlled by an OR gate, a positive trigger from one of the three switches fed via a diode, to stop the switch press affecting the other switches, triggers the output of OR gate which in turn enables the LDO and also switches the other OR gate High so the when the original trigger is removed the LDO remeaind enabled.</span></p><h2 style="text-align: left;"><span style="font-family: verdana;">Power Supply and Triggering</span></h2><p style="text-align: left;"><span style="font-family: verdana;">Once the LDO is enabled it powers up the ESP and one of the first things done is for the output controlling the gate to be switched High to keep the gate's output from being switched off, once the code has finished it's job then the output is switched low which causes the OR gate's output to go low and turn off the power to the ESP.</span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4UpMSL_nGxdQc9hCh_ckqWBZS9aChqbYA5wCVwOgPjmy8w7n_moEcTVVF1b69rGNWO_8zREpkgqUda6TBYlpC-khJAGQDXEDjuknYRdnQzPtl9iQPBVmHtROoFpgjzVabtnIQzSx0AR3tbvN8FOrt4NIEhfgcepSlrNV8dST4_yTOTzROGRbm9ksQ/s2122/power%20supply.png" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="733" data-original-width="2122" height="222" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4UpMSL_nGxdQc9hCh_ckqWBZS9aChqbYA5wCVwOgPjmy8w7n_moEcTVVF1b69rGNWO_8zREpkgqUda6TBYlpC-khJAGQDXEDjuknYRdnQzPtl9iQPBVmHtROoFpgjzVabtnIQzSx0AR3tbvN8FOrt4NIEhfgcepSlrNV8dST4_yTOTzROGRbm9ksQ/w640-h222/power%20supply.png" title="Power supply" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><h2 style="text-align: left;"><span style="font-family: verdana;">The Buttons</span></h2><p style="text-align: left;"><span style="font-family: verdana;">The Buttons are connected individually to the inputs on the ESP and also connected all together via diodes to the Trigger input circuit.</span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwA0peLA09Pj7FV02iBe-D4NWNYPSU9yaW39dSjA-2mbc8u_p3I_tigD08_aXXXc7g16lpBmt0k_nZj_d5kbbuHIDe3uL5DejieVRC3g4hdZl4efdRU9Y3FemIXpUV9IRDXmuWQKfUKgQIhUySxjS7iU4foKpXgFKsyBs4whbJymphLApCvNfKdQm9/s483/Buttons%20Trigger%20Circuit.png" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="463" data-original-width="483" height="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwA0peLA09Pj7FV02iBe-D4NWNYPSU9yaW39dSjA-2mbc8u_p3I_tigD08_aXXXc7g16lpBmt0k_nZj_d5kbbuHIDe3uL5DejieVRC3g4hdZl4efdRU9Y3FemIXpUV9IRDXmuWQKfUKgQIhUySxjS7iU4foKpXgFKsyBs4whbJymphLApCvNfKdQm9/w400-h384/Buttons%20Trigger%20Circuit.png" width="400" /></span></a></div><span style="font-family: verdana;"><br /></span><p style="text-align: left;"><span style="font-family: verdana;">The Schematic shows multiple buttons because I allowed for two types of button to be used, 6mm x 6mm pushbuttons or 12mm x 12mm pushbuttons, you can also use SMD tactile buttons soldered to the footprint of the 6mm buttons.</span></p><h2 style="text-align: left;"><span style="font-family: verdana;">The ESP</span></h2><p style="text-align: left;"><span style="font-family: verdana;">The ESP connections are fairly standard with a Reset button and a Flash button.</span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggXbZLPq48t8mvL4Ys5QrUftXFsjkZs0J74goNXcMDq3H3Il4oPLt_HqC-VbtFDSpXtGNFtJ7P7F9uFB6OeItyOjjyuL_ztonc_xbq2XYVa_A76yHSNHh8MiaIX8sQuD7cNOVJgiZmExf-UBjXaC3aeafLIDrtQmWtWzGKeuVdwz3ceirgDLlj5icC/s1195/ESP.png" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="877" data-original-width="1195" height="294" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggXbZLPq48t8mvL4Ys5QrUftXFsjkZs0J74goNXcMDq3H3Il4oPLt_HqC-VbtFDSpXtGNFtJ7P7F9uFB6OeItyOjjyuL_ztonc_xbq2XYVa_A76yHSNHh8MiaIX8sQuD7cNOVJgiZmExf-UBjXaC3aeafLIDrtQmWtWzGKeuVdwz3ceirgDLlj5icC/w400-h294/ESP.png" width="400" /></span></a></div><span style="font-family: verdana;"><br /></span><h2 style="text-align: left;"><span style="font-family: verdana;">Complete Circuit</span></h2><div style="text-align: left;"><span style="font-family: verdana;">Here is the overall schematic for the projecy, this one has the additional Pull downs, R15, 15 and 16 that I forgot to add on the first PCB design.</span></div><div style="text-align: left;"><span style="font-family: verdana;"><br /></span></div><div style="text-align: left;"><span style="font-family: verdana;">Get the KiCAD files from Github - </span><a href="https://github.com/gadjet/WiFiButtons" rel="nofollow" style="font-family: verdana;" target="_blank">https://github.com/gadjet/WiFiButtons</a></div><div style="text-align: left;"><span style="font-family: verdana;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSDABSVnf6ukdCzGFoNiTxIZbBSdJhWJfl-F0XvnzH-WEcv9gnMCWA7X_qr9_yztrpXIItfib8azV5TXvr1NZ6Ex51gNUQ6gAAkochZK4hmq6joO4o6GXSQSt20HkDntrOphNpJKtjk0B7AqzIVlu_XK-sGJlyqGEPw4iRooylo62TVnf7MDqRKQD8/s2601/Schematic_Fixed%20pulldowns.png" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="1780" data-original-width="2601" height="438" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSDABSVnf6ukdCzGFoNiTxIZbBSdJhWJfl-F0XvnzH-WEcv9gnMCWA7X_qr9_yztrpXIItfib8azV5TXvr1NZ6Ex51gNUQ6gAAkochZK4hmq6joO4o6GXSQSt20HkDntrOphNpJKtjk0B7AqzIVlu_XK-sGJlyqGEPw4iRooylo62TVnf7MDqRKQD8/w640-h438/Schematic_Fixed%20pulldowns.png" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><h2 style="text-align: left;"><span style="font-family: verdana;">PCB</span></h2><p style="text-align: left;"><span style="font-family: verdana;">The initial PCB</span></p><p style="text-align: left;"><span style="font-family: verdana;">Get the KiCAD files from Github - </span><a href="https://github.com/gadjet/WiFiButtons" rel="nofollow" style="font-family: verdana;" target="_blank">https://github.com/gadjet/WiFiButtons</a></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs9AWRKztOwbr4JEopcpZoWHy5iDpLuy3I2awPLYmH9tMcX5GLiHGwZM6-G4wW-TiO0oD1o4qaiI9u3NmpktTTIBJ0qaL3G6k1JervJJoSH-gv-EkguaRL4xnZnEiR_z9mOcxdsnpCgQRbzROx7Q3o_VA5BQ4IeGgRyjdNfNioLfbsFYqajPhYDaXx/s2668/PCB%20bottom.png" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="792" data-original-width="2668" height="190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs9AWRKztOwbr4JEopcpZoWHy5iDpLuy3I2awPLYmH9tMcX5GLiHGwZM6-G4wW-TiO0oD1o4qaiI9u3NmpktTTIBJ0qaL3G6k1JervJJoSH-gv-EkguaRL4xnZnEiR_z9mOcxdsnpCgQRbzROx7Q3o_VA5BQ4IeGgRyjdNfNioLfbsFYqajPhYDaXx/w640-h190/PCB%20bottom.png" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijcCK9L1gu-fFkCAlENzgdu1umR-6l2m6BArWx3bBS3Aypj9O4KO2mc5yXKlPIqaEAzj84y5D1JtD-hHHKFyuzbdi_eHqgoPf9xejjV61ysBPS4QAYWGSsU3G3cU7mEy_6YICc9ns6elYhd1gEgAL2Vz3jPASWAcZGtTsN8ugwXEYG7ZVM0NkQ5WGr/s2845/PCB%20top.png" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="804" data-original-width="2845" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijcCK9L1gu-fFkCAlENzgdu1umR-6l2m6BArWx3bBS3Aypj9O4KO2mc5yXKlPIqaEAzj84y5D1JtD-hHHKFyuzbdi_eHqgoPf9xejjV61ysBPS4QAYWGSsU3G3cU7mEy_6YICc9ns6elYhd1gEgAL2Vz3jPASWAcZGtTsN8ugwXEYG7ZVM0NkQ5WGr/w640-h180/PCB%20top.png" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgmfnWArfRdUv-s8_arG96_k6HkKbIMZzr6GyCW2KUu8vZztD7poDqrxDh1wEEz3JLg0K5lrUBzXtKbq7efLQkEFIcw61j9dkr43750mZ8ZlXBnO_h6IdXSJJzhQHRZsaHVclJ0AfvP75T87pnC_votAWXyTtf5uSlrvlpgJ-v6n9wAMx53HXoe7XX/s3319/20220601_151854.jpg" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="880" data-original-width="3319" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgmfnWArfRdUv-s8_arG96_k6HkKbIMZzr6GyCW2KUu8vZztD7poDqrxDh1wEEz3JLg0K5lrUBzXtKbq7efLQkEFIcw61j9dkr43750mZ8ZlXBnO_h6IdXSJJzhQHRZsaHVclJ0AfvP75T87pnC_votAWXyTtf5uSlrvlpgJ-v6n9wAMx53HXoe7XX/w640-h170/20220601_151854.jpg" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeXlv1WameMfdf6oZgcNx8p0XqGTrLaUxHES_oObzlbHO9guRucP5MT6JH2tCvXExs5JoES8qC1QOahizLUPq7TJjoB21rl1erECb2kHFU4OuAi645bWYEi8OxdzIP10zLRgPp8Rj3kVB8OdQUw4ExYOzCwM6Fa1eNcOAcpccg92fQt09Go7GgerGK/s3575/20220601_151913.jpg" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="949" data-original-width="3575" height="170" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeXlv1WameMfdf6oZgcNx8p0XqGTrLaUxHES_oObzlbHO9guRucP5MT6JH2tCvXExs5JoES8qC1QOahizLUPq7TJjoB21rl1erECb2kHFU4OuAi645bWYEi8OxdzIP10zLRgPp8Rj3kVB8OdQUw4ExYOzCwM6Fa1eNcOAcpccg92fQt09Go7GgerGK/w640-h170/20220601_151913.jpg" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><h2 style="text-align: left;"><span style="font-family: verdana;">The Mod to add the Pulldown resistors</span></h2><div style="text-align: left;"><span style="font-family: verdana;">Unfortunately I forgot to add some pulldown resistors on the original circuit (have been added on the later PCB layout.</span></div><div style="text-align: left;"><span style="font-family: verdana;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_oOaSB21YZ6xogg8P-SQL3Fk1XydJPunsAiCdbpuphim3Q9uV7DuLkuCTVwY4-lCaMb8En53vU3CNTOOORni0uJQL8-XOCcJBH3Pzp4ePqmFIDa94aNzSc5_r4tS2kU6u42trOE_2jsXmzP6OUpk-D2qsG37LUty7lNZJCZtF6M6Gqph8e1PcYQHX/s4032/20220601_130755%201.jpg" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: verdana;"><img border="0" data-original-height="1816" data-original-width="4032" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_oOaSB21YZ6xogg8P-SQL3Fk1XydJPunsAiCdbpuphim3Q9uV7DuLkuCTVwY4-lCaMb8En53vU3CNTOOORni0uJQL8-XOCcJBH3Pzp4ePqmFIDa94aNzSc5_r4tS2kU6u42trOE_2jsXmzP6OUpk-D2qsG37LUty7lNZJCZtF6M6Gqph8e1PcYQHX/w640-h288/20220601_130755%201.jpg" width="640" /></span></a></div><span style="font-family: verdana;"><br /></span><h2 style="text-align: left;"><span style="font-family: verdana;">The Transmitter Code</span></h2><p style="text-align: left;"><span style="font-family: verdana;">The following code sends an ESP-NOW message packet whenever a button is pressed comprising the Device ID, the MAC Address, the button pressed and the battery voltage. Once the message has been sent the power is turned off by setting GPIO2 LOW.</span></p><div style="text-align: left;"><span style="font-family: verdana;">Get the code from Github - </span><a href="https://github.com/gadjet/WiFiButtons" rel="nofollow" style="font-family: verdana;" target="_blank">https://github.com/gadjet/WiFiButtons</a></div><div style="text-align: left;"><span style="font-family: verdana;"><br /></span></div><div style="text-align: left;"><span style="font-family: verdana;"><br /></span></div><h2 style="text-align: left;"><span style="font-family: verdana;">The Receiver Code</span></h2><p style="text-align: left;"><span style="font-family: verdana;">This Code takes the received data from the Transmitter and sends it to the Serial port.</span></p><div style="text-align: left;"><div><span style="font-family: verdana;">Get the code from Github - </span><a href="https://github.com/gadjet/WiFiButtons" rel="nofollow" style="font-family: verdana;" target="_blank">https://github.com/gadjet/WiFiButtons</a></div><div><br /></div><h2 style="text-align: left;"><span style="font-family: verdana;">Quiescent Current Profile</span></h2><div><span style="font-family: verdana;">The point of the trigger circuit is to reduce the standby current as much as possible so the battery will last as long as possible, this configuration consumes around 1.5uA in standby and an average of 60mA for around 200mS when a button is pressed.</span></div><div><span style="font-family: verdana;"><br /></span></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLQAwChMR4Hgb0cs1EW8kVmBcq3gOUmlsjbgFSBfJO4mqyZMkxqFax8zVKWDgHdbHgCAqgExWivyII8UfdiSseZPMwTsCKdfnp8CHVqcW1aVaEdTxPzzm2utYPqfFYyowDamybrcuyeU3HPAfBdN35ZjoD3e7BW8FXV47w5Es0Qqd861g5pqnLt8z7/s2967/3%20%20Button%20WiFi%20Remote%20Quiescent1.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1808" data-original-width="2967" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLQAwChMR4Hgb0cs1EW8kVmBcq3gOUmlsjbgFSBfJO4mqyZMkxqFax8zVKWDgHdbHgCAqgExWivyII8UfdiSseZPMwTsCKdfnp8CHVqcW1aVaEdTxPzzm2utYPqfFYyowDamybrcuyeU3HPAfBdN35ZjoD3e7BW8FXV47w5Es0Qqd861g5pqnLt8z7/w640-h390/3%20%20Button%20WiFi%20Remote%20Quiescent1.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><br /><span style="font-family: verdana;"><br /></span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0gUGeJzd21-if0PMa_aM5qq-xDUzrQjdGCKT-A6IW5oL7cM58VADk9nV0fy2WjyvK57AtKOwv4J50dQn3FL2mkyXz2BcONPZqVQH9LapR1iQ0N3PVYh4so079MrRVERW2wih79u8HMd3JGsWpzhap-EUEcqNxFJAoyyvXzN2sWB6j4bK3lnbFQgbK/s2967/Without%20Serial%20output.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1808" data-original-width="2967" height="390" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0gUGeJzd21-if0PMa_aM5qq-xDUzrQjdGCKT-A6IW5oL7cM58VADk9nV0fy2WjyvK57AtKOwv4J50dQn3FL2mkyXz2BcONPZqVQH9LapR1iQ0N3PVYh4so079MrRVERW2wih79u8HMd3JGsWpzhap-EUEcqNxFJAoyyvXzN2sWB6j4bK3lnbFQgbK/w640-h390/Without%20Serial%20output.png" width="640" /></a></div><br /><div><br /></div></div><p style="text-align: left;"><span style="font-family: arial;"></span></p>Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com4tag:blogger.com,1999:blog-4455987088008622536.post-48980030741363489592022-03-28T08:01:00.004+01:002024-02-10T18:29:33.367+00:00The many versions of the Wireles Door Sensor an Version 5<p> </p><h2>The Journey so far</h2><p>I have to admit that it's become a bit of an obsession to try and get this sensor smaller and to use less power at each revision. well I've just finished version 5 which has definitely got the consumption down to a really low level, 3.9uA at its lowest.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDXc1ihJR2bNx2iJl266YADGD_S_zllxQU8dRqM1tdPERw7TqLj3npgdmkelza-Ad2afk-nHaZNwYpKYN6bQ1fY-sxa61KvHcsbLOff43GEQwukzpIKjGITEepRJkYp4ypqlrllQA9pwU6aYEnIrSX6X7MoyatAbuhahlen6lqPDCiCt7v5K9habH6/s2640/20220202_081712.jpg" style="margin-left: 1em; margin-right: 1em;"><img alt="Versions 1 to 4 in a row" border="0" data-original-height="2640" data-original-width="1816" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDXc1ihJR2bNx2iJl266YADGD_S_zllxQU8dRqM1tdPERw7TqLj3npgdmkelza-Ad2afk-nHaZNwYpKYN6bQ1fY-sxa61KvHcsbLOff43GEQwukzpIKjGITEepRJkYp4ypqlrllQA9pwU6aYEnIrSX6X7MoyatAbuhahlen6lqPDCiCt7v5K9habH6/w440-h640/20220202_081712.jpg" width="440" /></a></div><div><br /></div>....... and Version 5<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjecryB7fQ_fl03thuefD2usOCdUuRc2XLdweYxux_GFo5EMeSqAoszQnLrufpcAX2aa033L9jvcSAGYwQ2GpwJ2M1ssmYpEFN154HaXqXGey3Y4Hwm2nQOtq8QbHhIMH5Ai44bNv5GptMENXh0wWQP1K2ufjoTij_hR76eSwU2ZfH3s4sgsXJRG6ty/s4032/20220325_195626.jpg" style="margin-left: 1em; margin-right: 1em;"><img alt="Version 5 assembled PCB" border="0" data-original-height="1816" data-original-width="4032" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjecryB7fQ_fl03thuefD2usOCdUuRc2XLdweYxux_GFo5EMeSqAoszQnLrufpcAX2aa033L9jvcSAGYwQ2GpwJ2M1ssmYpEFN154HaXqXGey3Y4Hwm2nQOtq8QbHhIMH5Ai44bNv5GptMENXh0wWQP1K2ufjoTij_hR76eSwU2ZfH3s4sgsXJRG6ty/w400-h180/20220325_195626.jpg" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjz_tHJ7uBf4fgXmXBb7qzuLOh1bcazgi9_i8L9vhk6FKTPZBg_dcNb7t0bUQriI4VUQelCm4TYRqpqeG5R_jCToHOEPzQLQDE0KhqkACmPhUKoOqrXcAsyn-OKv45PFueOMYofM76ZpFghsg7xcMnDGdB8Rb8xSoQdzfLz_VP9PSlvcbotVKB-AAQW/s2215/20220326_164720.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1411" data-original-width="2215" height="255" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjz_tHJ7uBf4fgXmXBb7qzuLOh1bcazgi9_i8L9vhk6FKTPZBg_dcNb7t0bUQriI4VUQelCm4TYRqpqeG5R_jCToHOEPzQLQDE0KhqkACmPhUKoOqrXcAsyn-OKv45PFueOMYofM76ZpFghsg7xcMnDGdB8Rb8xSoQdzfLz_VP9PSlvcbotVKB-AAQW/w400-h255/20220326_164720.jpg" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><div><br /></div>Version 5 has two functions, the normal reed switch trigger so it can be used as a Window/Door sensor and a single button input so it can be used as a Doorbell switch or general WiFi button.<div><br /></div><div>The trigger circuitry combines an edge triggered Monostable circuit from two XOR gates and a single OR gate latch circuit, this latch is triggered either by a pulse from the Monostable or the press of a button which sets the latch.</div><div>Once the latch has been set it can then be reset by a LOW signal from the ESP12 when the code has finished running on the ESP12, I used GPIO16 as it is held high during boot.</div><div><h4 style="text-align: left;">Schematic</h4><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg00xkjSy1LPBE_DBUHkiB9vHNMzAiT_j3rkQzsOe-dV93JkYjizZByHGdTgndbY1tgNZZMw6QMz1DCsBev_1zNh0QN7ay7xiQhtpeiZds1W7eQKbdHnDdxjbIEfVM3R1Oa6YoIYsqGQYE4Md2LAyDua5D6JDzKgCRrDU0iiFXi5WtlHpZdA25fEe3Y/s1702/Schematic.jpg" style="margin-left: 1em; margin-right: 1em;"><img alt="Circuit diagram V5" border="0" data-original-height="1702" data-original-width="1669" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg00xkjSy1LPBE_DBUHkiB9vHNMzAiT_j3rkQzsOe-dV93JkYjizZByHGdTgndbY1tgNZZMw6QMz1DCsBev_1zNh0QN7ay7xiQhtpeiZds1W7eQKbdHnDdxjbIEfVM3R1Oa6YoIYsqGQYE4Md2LAyDua5D6JDzKgCRrDU0iiFXi5WtlHpZdA25fEe3Y/w628-h640/Schematic.jpg" width="628" /></a></div><br /><div>Using the circuit above the quiescent current of the whole device when there is no magnet next to the reed switch, i.e. door open is 3.90uA and if you were using it as a WiFi connected button then that would be the Quiescent drain, if used as a door/Window sensor then when the magnet is next to the reed switch the quiescent is slightly higher at 5.4uA due to R1 drawing current when the reed switch is closed.</div><div><br /></div><h4 style="text-align: left;">Battery Life</h4><h3 style="text-align: left;">Actual Current consumption</h3><div>Using a <span face="Tahoma, Geneva, sans-serif" style="background-color: white; font-size: 13px;"> </span><a href="https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2" style="background-attachment: initial; background-clip: initial; background-color: white; background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; background: url("data:image/gif;base64,R0lGODlhCgAKAIMAAAAAAMY5IedrUu+Ec/etpQAAAACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD//////yH5BAMAAAUALAAAAAAKAAoAAAQisMgSqp1hTLqDwFZFgFIwEl9FndWgEgOhBlwh13gJhrQUAQA7") right center no-repeat rgb(255, 255, 255); color: #dd1111; font-family: Tahoma, Geneva, sans-serif; font-size: 13px; font-weight: bold; padding-right: 12px;" target="_blank">Nordic Power Profiler Kit II</a> I made some current measurements of the device in the different states: -</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZE_weY8pa7iYlamaSqnuB3yP7b2_iN8Tj8bQOcwsNa-X6XW2KmxVhsBZ3c8f5llLg7YaFdqVhNo7JFbRQWhiS3xXUJDLjMapiaQsHWshQMmYrmiavqlMRW8TkY1F5WRgkaGN4iXhIf3tn5eHd6velroDZuuXbSluyGIsR5MZbYGdANK8knGipefs8/s3235/V5%20Quiescent%20current%20after%20fix.png" style="margin-left: 1em; margin-right: 1em;"><img alt="Current Consumption Graph" border="0" data-original-height="1538" data-original-width="3235" height="304" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZE_weY8pa7iYlamaSqnuB3yP7b2_iN8Tj8bQOcwsNa-X6XW2KmxVhsBZ3c8f5llLg7YaFdqVhNo7JFbRQWhiS3xXUJDLjMapiaQsHWshQMmYrmiavqlMRW8TkY1F5WRgkaGN4iXhIf3tn5eHd6velroDZuuXbSluyGIsR5MZbYGdANK8knGipefs8/w640-h304/V5%20Quiescent%20current%20after%20fix.png" width="640" /></a></div><br /><div><br /></div><div>Using an online battery lifetime calculator I found <a href="https://climbers.net/sbc/iot-battery-runtime-calculator" rel="nofollow" target="_blank">here</a> I calculated these battery times based on a usage of 10 activations per day: -</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHRMJIMKSwOtfAK1EsHj5AHYDD3sR52LC5Fi6_zCP5HUeN5m4Jm_5pHMsw1uZhMjinHs04zxZOUqiJEfOtFHBIGlHRaE3s-csFIAbv3ZxAYxRpiLvMO84_h4JfW5Dm5C5EedMROMjF2f6t3Ope9SaAKHYJwqr0DHWDEjSUeDskL31VIuRKh3bPY0MM/s1138/Battery%20life%20Calc%20@%205.4uA.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="1138" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHRMJIMKSwOtfAK1EsHj5AHYDD3sR52LC5Fi6_zCP5HUeN5m4Jm_5pHMsw1uZhMjinHs04zxZOUqiJEfOtFHBIGlHRaE3s-csFIAbv3ZxAYxRpiLvMO84_h4JfW5Dm5C5EedMROMjF2f6t3Ope9SaAKHYJwqr0DHWDEjSUeDskL31VIuRKh3bPY0MM/w305-h128/Battery%20life%20Calc%20@%205.4uA.jpg" width="305" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg07UkOy8C29wNpt7eZlVIe9Ibd3FY2vbchiW-AtdaAjyzYsA2w6JQSYjTWRMDIQ1JUSAmorNwoWpKiLRuIXfEgvqbFFpOMV6d0K4-9Ez92X0uWt73qu5mTv35VUNdGCoY0lV-1aBfeNA0x75X_Ws3Zr5KhgmKEiVUSflVAKbHrTR6zeiPFGfIt6qbO/s1150/Battery%20life%20Calc%20@%203.9uA.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="499" data-original-width="1150" height="132" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg07UkOy8C29wNpt7eZlVIe9Ibd3FY2vbchiW-AtdaAjyzYsA2w6JQSYjTWRMDIQ1JUSAmorNwoWpKiLRuIXfEgvqbFFpOMV6d0K4-9Ez92X0uWt73qu5mTv35VUNdGCoY0lV-1aBfeNA0x75X_Ws3Zr5KhgmKEiVUSflVAKbHrTR6zeiPFGfIt6qbO/w303-h132/Battery%20life%20Calc%20@%203.9uA.jpg" width="303" /></a></div><div class="separator" style="clear: both; text-align: center;"><div style="text-align: left;">As you can see the worst consumption will give a battery life of more than 7 years! although this will only be an esitmate and in "real life" I assume there will be other factors that may impact on the battery life but only time will tell but I think you would have a good chance of getting a few years out of a relatively small cell.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">The files are available on my <a href="https://github.com/gadjet/Window-Door-sensor-Version-5" target="_blank">Github</a> page</div></div><br /><div><br /><p><br /></p></div></div>Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com109tag:blogger.com,1999:blog-4455987088008622536.post-52528115107537098832021-12-04T20:05:00.013+00:002021-12-06T19:38:43.390+00:00Door/Window Sensor with an ESP8266<p><span style="font-size: medium;">It's been a long time since my last post but I thought I would write up about my latest project - a door/window sensor using an ESP 8266.</span></p><p><span style="font-size: medium;">I've bought a few door sensors in the past from Tuya and a Hive one (load of rubbish) but I came across a brilliant YouTube video from a gent called MakerMeik who used a logic toggle circuit to wake up the ESP from sleep mode when a reed switch is opened or closed (<a href="https://youtu.be/vxbuO1zWo3w">https://youtu.be/vxbuO1zWo3w</a>).</span></p><p><span style="font-size: medium;">Using the two XOR logic gates alowed both the door open and door closed to wake up the ESP by toggling the Enable pin whilst also passing the reed switch state to the ESP to publish.</span></p><p><span style="font-size: medium;">Mike used the ESP to connect to the router via DHCP (or fixed IP) which took a few seconds to establish before then logging onto your MQTT server and publishing the door status.</span></p><p><span style="font-size: medium;">So I downloaded Kicad and gave it a try, I had tried Kicad a few years ago and was a bit disappointed but the latest version was streets ahead of what I remembered and I soon had a PCB ready to send off for fabrication.</span></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPDBr-gKT1K9epaPrsAADZ9G7MFkHQ5g-JwO4V5Kb7gh7a83Vtuj7zKnCRomK7tI8bEUAMXdcAidfuN3qGNzUNG7UDl-KlpMDLC0kUMxMMFSoxCxZpzNpeqirxJEJdhuIvwzkNzylVtdw/s3173/2021-11-18+11.41.57.jpg" style="margin-left: auto; margin-right: auto;"><span style="font-size: medium;"><img border="0" data-original-height="1055" data-original-width="3173" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPDBr-gKT1K9epaPrsAADZ9G7MFkHQ5g-JwO4V5Kb7gh7a83Vtuj7zKnCRomK7tI8bEUAMXdcAidfuN3qGNzUNG7UDl-KlpMDLC0kUMxMMFSoxCxZpzNpeqirxJEJdhuIvwzkNzylVtdw/w499-h165/2021-11-18+11.41.57.jpg" width="499" /></span></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><span style="font-size: medium;">Bare PCB</span></td></tr></tbody></table><div class="separator" style="clear: both; text-align: center;"><span style="font-size: medium;"><br /></span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhw_X5wr_hN8f0oKwCtTYJu-CSHBEeg4-VVwNFXR66X4VUtyXBzgcpwIPNHqM0RXaZB990I5-pxyHSjiSmrGOfkfAXgYzAtLlITY4x02aqAV8pwTFYuiQfIGOAK5AltLbiJC0NW2BfH-Hg/s2675/2021-11-18+14.43.48.jpg" style="margin-left: auto; margin-right: auto;"><span style="font-size: medium;"><img border="0" data-original-height="1040" data-original-width="2675" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhw_X5wr_hN8f0oKwCtTYJu-CSHBEeg4-VVwNFXR66X4VUtyXBzgcpwIPNHqM0RXaZB990I5-pxyHSjiSmrGOfkfAXgYzAtLlITY4x02aqAV8pwTFYuiQfIGOAK5AltLbiJC0NW2BfH-Hg/w496-h192/2021-11-18+14.43.48.jpg" width="496" /></span></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><span style="font-size: medium;">Populated PCB</span></td></tr></tbody></table><span style="font-size: medium;"><br /></span><div class="separator" style="clear: both; text-align: left;"><span style="font-size: medium;">The PCBs were delivered and I assembled one which worked as expected (nice surprise) and while I was waiting for the PCBs to arrive back from PCBWay I exported the PCB design as a 3D model (STEP file) which I was able to import into Fusion360 and use as the basis for an enclosure.</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-size: medium;">Initially my idea was to use an 18650 Lithium cell as I had plenty that I'd reclaimed from old laptop batteries, which still had reasonable capacities, my idea was to use two halves that could be screwed together holding the PCB and battery, this could be screwed to a surface or stuck on with double sided adhesive tape.</span></div><div class="separator" style="clear: both; text-align: center;"> <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3tiB59scvPhZb-jGoU2q7nAvU1Xwg-4qvoCnGLloAJkCsLkZcbQLI20cUKSTNiQEnMLl87WfgbQ3z__KKsJ71A6Xzxsisk927-RO81qdOBwhmIu4nnBWcrTrPLHnseF6JbA2tUQKlN44/s832/ESP+Door+Sensor+1.0+v14+%25283%2529.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="832" data-original-width="676" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3tiB59scvPhZb-jGoU2q7nAvU1Xwg-4qvoCnGLloAJkCsLkZcbQLI20cUKSTNiQEnMLl87WfgbQ3z__KKsJ71A6Xzxsisk927-RO81qdOBwhmIu4nnBWcrTrPLHnseF6JbA2tUQKlN44/s320/ESP+Door+Sensor+1.0+v14+%25283%2529.png" width="260" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcqvEjB3uhMZGcx4kTsQqy24AA2MWLwvi-yQO0BnmGfP2u2VdF5angJEJfoBmJ2h3gZGkgEOfpJ9ZGjkPPnBRbJdWVS-MENpQiacE8yTEg5JI9e5XznwkHlOyMze4v7emkCfqe42iaxnw/s789/ESP+Door+Sensor+1.0+v14+%25284%2529.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="789" data-original-width="754" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcqvEjB3uhMZGcx4kTsQqy24AA2MWLwvi-yQO0BnmGfP2u2VdF5angJEJfoBmJ2h3gZGkgEOfpJ9ZGjkPPnBRbJdWVS-MENpQiacE8yTEg5JI9e5XznwkHlOyMze4v7emkCfqe42iaxnw/s320/ESP+Door+Sensor+1.0+v14+%25284%2529.png" width="306" /></a><br /><br /></div><br /></div><div class="separator" style="clear: both; text-align: left;">The design is quite tall at 33mm but this is OK for my back door which is double glazed and the door is quite deep so the deep back places the reed switch nicely inline with the magnet on the door.</div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl2VFErLEUmXbnj7NuyLTO_qBZZcyxqv8jltO4DICpkqCU5npu5nRBtD1D0TUkSH9QWYX-G9RZmccWM3qDlT-ttcvHAzFGE9Uee8cOnxum8UYwcerMbG0Q5T8gqKlNyRNBMKU7pkU8hYQ/s2722/2021-12-04+19.20.47.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="1816" data-original-width="2722" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl2VFErLEUmXbnj7NuyLTO_qBZZcyxqv8jltO4DICpkqCU5npu5nRBtD1D0TUkSH9QWYX-G9RZmccWM3qDlT-ttcvHAzFGE9Uee8cOnxum8UYwcerMbG0Q5T8gqKlNyRNBMKU7pkU8hYQ/w400-h266/2021-12-04+19.20.47.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Printed enclosure<br /></td></tr></tbody></table><br />Having finished this version of the sensor I've been investigating ways to increase the battery life and reducing the overall size.<div><br /></div><div>I found some smaller batteries that I could use with this design in conjunction with ESP-NOW code that uses alot less transmission time so I designed another rear half that is alot shallower for the new battery.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhkrIEaWpa3yv8qA6TMTYwVUJ7Zpw4FE6oaNnobyD3CDrhvuDO2GCMasB7pJV3eDzTrMtRgeNaJynnjE07RYOEHe2XSyTtz4p2OioA1Lg3ut8m1j96QbV7VFTP5Xh9OZ21I-6z6DuW82bili0k95pe4cA4xsj0NYlU5k556G8pc1iS7JDObF6RLUQ8b=s3480" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1595" data-original-width="3480" height="184" src="https://blogger.googleusercontent.com/img/a/AVvXsEhkrIEaWpa3yv8qA6TMTYwVUJ7Zpw4FE6oaNnobyD3CDrhvuDO2GCMasB7pJV3eDzTrMtRgeNaJynnjE07RYOEHe2XSyTtz4p2OioA1Lg3ut8m1j96QbV7VFTP5Xh9OZ21I-6z6DuW82bili0k95pe4cA4xsj0NYlU5k556G8pc1iS7JDObF6RLUQ8b=w400-h184" width="400" /></a></div><div><br /></div><br /><div><div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEh5l5x6ZxSuzcCcmE3yKhtrV6CS8ZDKeIXoDNgvjRngImsT0z4szgl5FzTlH6s0krJCo53mABPoJvo1wJhZke9l_Ja_guS3spU7lQ2vCYeqMmp69XwC2N2EMKPFGE3LCvSXuI9GuoNmoJpBX11gmjf5a5ogSFU-kHMTOrtQmD3D3-nRMA-4IeE5eaYC=s736" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="722" data-original-width="736" height="314" src="https://blogger.googleusercontent.com/img/a/AVvXsEh5l5x6ZxSuzcCcmE3yKhtrV6CS8ZDKeIXoDNgvjRngImsT0z4szgl5FzTlH6s0krJCo53mABPoJvo1wJhZke9l_Ja_guS3spU7lQ2vCYeqMmp69XwC2N2EMKPFGE3LCvSXuI9GuoNmoJpBX11gmjf5a5ogSFU-kHMTOrtQmD3D3-nRMA-4IeE5eaYC=s320" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Smaller rear half for smaller battery</td></tr></tbody></table><div class="separator" style="clear: both; text-align: center;"><br /></div></div><div>One tip I can give is to buy the plastic encapsulated reed switches instead of the normal glass ones as they are prone to breaking, even though I used surface mount pads to solder the switch rather than having to bend the wires to go through holes.</div><div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqKT_BL2PKOxWkgwq429jQzdyVjL5LxVlgpj9MF3ifwjViZ1qrrENgKP_JPTGjDMt33Hh7HT9K9nBz2u4Wzi4ujUG91eQzJ1bT-jbLnP8lGQ3bEH-X3sth3JYT16UAjZDTysMm3Yj7NKo/s800/2021-12-04+19.55.45.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="360" data-original-width="800" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqKT_BL2PKOxWkgwq429jQzdyVjL5LxVlgpj9MF3ifwjViZ1qrrENgKP_JPTGjDMt33Hh7HT9K9nBz2u4Wzi4ujUG91eQzJ1bT-jbLnP8lGQ3bEH-X3sth3JYT16UAjZDTysMm3Yj7NKo/w400-h180/2021-12-04+19.55.45.jpg" width="400" /></a></div><br /><div>With my next version I will be trying out the PCB assembly service from JLCPCB so that I can utilise smaller SMD components and not have to solder them together myself!!</div><div><br /></div><div>Some things I want to improve: -</div><div><ul style="text-align: left;"><li>Smaller size</li><li>Longer battery life and/or smaller battery</li><li>Add voltage divider to monitor actual battery voltage</li><li>Have a dual supply solution to use 1.5V AA cell with booster or single 3.6V Lipo cell without booster</li><li>Learn about ESP-NOW</li></ul><div>There are plenty of clever people out there on YouTube with some great ideas around home automation and using the ESP8266 and ESP32 so time to watch some videos.</div><div><br /></div><div>Gerbers, STL files etc. available from here <a href="https://1drv.ms/u/s!AkqVSEM4Y7kDhuZ0Lg1CdJrBs745Ug?e=ACkTkJ">https://1drv.ms/u/s!AkqVSEM4Y7kDhuZ0Lg1CdJrBs745Ug?e=ACkTkJ</a></div><div><br /></div><div>The code for the device is available from MakerMeik's GIThub page, watch his video.</div><div><br /></div><div>Version 2 coming soon .......</div><div class="separator" style="clear: both; text-align: left;"><br /></div><br /><p><br /></p></div></div></div><br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com4tag:blogger.com,1999:blog-4455987088008622536.post-55545655610227559052017-05-14T09:33:00.000+01:002017-05-14T09:33:16.126+01:00Hot water control using a Raspberry Pi Zero W<br />
Following on from the first blog about the hot water heating control here's what I put together for the mounting.<br />
Whilst looking for a suitable enclosure I came across an surface mount electrical socket back-box and I got to thinking "how can I mount the RPi W and relay in this?" so after some head scratching I thought about 3D printing some carriers to go inside the back-box.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGDmVrVAG0UrAOi5P8p7hgELPUOEeMRigmk_ij84fGK0odR-o6pS9aD0Au_oVgjhh6icB9Rl_bgi2USDrl7yf3c3qn7d0pUjZrO2MSLrtMhecrAHWj4qFNYSx6qwpJNQndKt1cgBcbwWU/s1600/Pi+Zero+holder.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGDmVrVAG0UrAOi5P8p7hgELPUOEeMRigmk_ij84fGK0odR-o6pS9aD0Au_oVgjhh6icB9Rl_bgi2USDrl7yf3c3qn7d0pUjZrO2MSLrtMhecrAHWj4qFNYSx6qwpJNQndKt1cgBcbwWU/s320/Pi+Zero+holder.png" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTufoKNkPfwoKablAWXxsjoMMfcdycM1BEdZrbkcenlAVCN8z0runER_U_UZlTGBxx0WYwnaywdiDizRJCF_QUjZ7Hyf0mdAwXi6PFtPpxHZjxraDWUCY1ailO3GXJWC56aFX7xQbwnms/s1600/Relay+carrier.png" imageanchor="1" style="clear: right; display: inline !important; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="156" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTufoKNkPfwoKablAWXxsjoMMfcdycM1BEdZrbkcenlAVCN8z0runER_U_UZlTGBxx0WYwnaywdiDizRJCF_QUjZ7Hyf0mdAwXi6PFtPpxHZjxraDWUCY1ailO3GXJWC56aFX7xQbwnms/s320/Relay+carrier.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS6O8pFQSMqZptcw775o2OYnuoo0oe_3J4aEKfGwstLF2pfRrLCbMDNQaBHfsdzzUwA1niVG4TzkwQTOYKqhKyfuWSB8TtJP9HTKY1_xZHE_azV3bDD4itWcxr47PvXYQtJv-Enyiag-Q/s1600/2017-03-14+10.26.22.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="302" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiS6O8pFQSMqZptcw775o2OYnuoo0oe_3J4aEKfGwstLF2pfRrLCbMDNQaBHfsdzzUwA1niVG4TzkwQTOYKqhKyfuWSB8TtJP9HTKY1_xZHE_azV3bDD4itWcxr47PvXYQtJv-Enyiag-Q/s320/2017-03-14+10.26.22.jpg" width="320" /></a></div>
The picture above shows two carriers printed to support the RPi and the relay board.<br />
<br />
Then I made the required entry holes in the back-box for the power cable (USB), the mains switching cable for the relay and the temperature sensor cable.<br />
<br />
This contraption has been sitting on my desk for a few weeks running quite happily and I've been checking the event log to make sure it's been switching on and off when it should.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRrFcfcrUhujkBAYUQTRdDJTdbvlWS0gn3i3xVnJgfaXqdCube26yF7wQOpCkKv3gr_K3btzCqOPmknhdzCtY73OeIcca_FIujnFyOVaKSsXL-TmdkWQFP6Ir2elYWoS4GNOvhSeRnTrE/s1600/2017-05-14+08.21.49.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRrFcfcrUhujkBAYUQTRdDJTdbvlWS0gn3i3xVnJgfaXqdCube26yF7wQOpCkKv3gr_K3btzCqOPmknhdzCtY73OeIcca_FIujnFyOVaKSsXL-TmdkWQFP6Ir2elYWoS4GNOvhSeRnTrE/s400/2017-05-14+08.21.49.png" width="193" /></a></div>
<br />
Next to interface it to the existing wiring.Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com4tag:blogger.com,1999:blog-4455987088008622536.post-39035981216578062812017-03-11T23:40:00.002+00:002017-03-21T19:25:47.140+00:00Hot water Remote Control using a Wemos D1 .... then a Raspberry Pi Zero WFor quite a while now I've been meaning to put together a project to control the Hot water heating remotely from my phone, I all ready have a 2nd generation Nest to control the heating but don't fancy spending the money for the 3rd generation just to add the water heating function.<br />
I started with the plan to use a <a href="https://www.google.co.uk/search?q=Wemos+D1+Mini&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjJytu-wc_SAhXsAMAKHa4tC6QQ_AUICSgC&biw=1865&bih=854" target="_blank">Wemos D1 Mini</a> with a couple of the plug-in modules like a relay module, processor module and a button module all placed on the dual base PCB.<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFPHPj50O-dUrgHGT9iyQksRrdpZq2gMJpXpxa-cwi-mnDgUizPlIN8hGwVL5BcbyT9HGC5EKl3Afxeup0HVbQHI9d8E89vFaFfOfcDa1l4jO7ATWuvCyBiByEA04g6z7UBskn4YNfUF8/s1600/1-Button-Shield-for-WeMos-D1.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFPHPj50O-dUrgHGT9iyQksRrdpZq2gMJpXpxa-cwi-mnDgUizPlIN8hGwVL5BcbyT9HGC5EKl3Afxeup0HVbQHI9d8E89vFaFfOfcDa1l4jO7ATWuvCyBiByEA04g6z7UBskn4YNfUF8/s200/1-Button-Shield-for-WeMos-D1.jpg" width="186" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Button Module</td></tr>
</tbody></table>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7usbUwGYSINX8Nka1HnlbWRZ6cFRGvP4FMJ5AXrmWL0xXv9PFAfCppb3YQVL4nwLQS559dFZpm1F793F5IR5bs-oi06VwGhy5sRs5fBnBo0pYAXu7ETkNN-Uvk1Ea8fT71gpjzR3Z_bY/s1600/WeMos-D1-Mini.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7usbUwGYSINX8Nka1HnlbWRZ6cFRGvP4FMJ5AXrmWL0xXv9PFAfCppb3YQVL4nwLQS559dFZpm1F793F5IR5bs-oi06VwGhy5sRs5fBnBo0pYAXu7ETkNN-Uvk1Ea8fT71gpjzR3Z_bY/s200/WeMos-D1-Mini.jpg" width="154" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Processor Module</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-4YUCXzFF9VtI-6gVuXx0E6DMQ1ChqK3ZatzJGEGIX4sGa995s69GU7IiRM7bKnju-VVljzzbRM46-Ei9sG_ij_ZPCd7HKDflcRgUsnn3yieqGPTJKsTfJYPaZhTmnAcB2UD_IqumCXg/s1600/Wemos_D1_Relay.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-4YUCXzFF9VtI-6gVuXx0E6DMQ1ChqK3ZatzJGEGIX4sGa995s69GU7IiRM7bKnju-VVljzzbRM46-Ei9sG_ij_ZPCd7HKDflcRgUsnn3yieqGPTJKsTfJYPaZhTmnAcB2UD_IqumCXg/s200/Wemos_D1_Relay.jpg" width="178" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Relay Module</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0jbKL6ExYdxuWHSWiaz-UZTG3MOY-K5-Dt-XZyMPc_0aX0TuHJW9qL76-hd824H1YmBFt_QlYCYrzejtBbfW-WnwRC-XE4zm89kSbISQKEWH-suzJq2xvELTgeEjRKLuFJYbNn7S_1r8/s1600/wemos-d1+PCB+motherboard.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" height="166" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0jbKL6ExYdxuWHSWiaz-UZTG3MOY-K5-Dt-XZyMPc_0aX0TuHJW9qL76-hd824H1YmBFt_QlYCYrzejtBbfW-WnwRC-XE4zm89kSbISQKEWH-suzJq2xvELTgeEjRKLuFJYbNn7S_1r8/s320/wemos-d1+PCB+motherboard.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Dual footprint Motherboard</td></tr>
</tbody></table>
For those of you not familiar with the Wemos D1 you have to be aware of which pins the different modules use because the relay module uses D1 which also happens to be used for one the I2C pins so if you wanted to use the I2C OLED display module it would clash. I decided to re-wire my relay pin to use D6 (GPIO12) as this is the default pin that the Sonoff / arendst software uses for the relay anyway.<br />
<br />
Once the parts were assembled and the software flashed (the button module happens to be the flash button as well)<br />
<br />
The idea was to load some software written by a chap called <a href="https://github.com/arendst/Sonoff-MQTT-OTA-Arduino" target="_blank">arendst on Github</a> this software allows you to control a relay via MQTT, usually used in WiFi controlled power sockets found at <a href="https://www.itead.cc/smart-socket.html" target="_blank">ITEAD</a> but there's no reason why it can't be used on any ESP8266 to drive a relay and more importantly read a connected temperature sensor like a DHT22 or DS18B20.<br />
<br />
I planned to control this from my Raspberry Pi 3 running <a href="https://nodered.org/" target="_blank">Node Red</a>, I would design a control layout using the Dashboard module, which serves up a webpage I can view on my phone/PC/tablet etc. inside my WiFi network.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPE7e3mWxLOqx-WuW4QB1Y67Tp0NKdCOiEO8CHz6RSYAi0rY2gS3a0V7uw6Yda4tY1PM9KSQkPb1g3C6VjNp_9tLvBLwGVbGedFT6fCPIV_DOgmwQKu6AX1D5DSN5z1xlB_-27fKFmS0s/s1600/Node+red+dashboard+UI.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPE7e3mWxLOqx-WuW4QB1Y67Tp0NKdCOiEO8CHz6RSYAi0rY2gS3a0V7uw6Yda4tY1PM9KSQkPb1g3C6VjNp_9tLvBLwGVbGedFT6fCPIV_DOgmwQKu6AX1D5DSN5z1xlB_-27fKFmS0s/s320/Node+red+dashboard+UI.png" width="180" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Work in progress Dashboard UI in Node Red</td></tr>
</tbody></table>
<br />
but could also be controlled outside my network using an MQTT app on my phone via the <a href="https://www.cloudmqtt.com/" target="_blank">Cloudmqtt </a>service using 4G data. <br />
<br />
I also got hold of an Amazon DASH Button which I've configured using a node "<a href="https://flows.nodered.org/node/node-red-contrib-amazondash" target="_blank">node-dash-button</a>", I've configured it so that pressing this button gives a 30 min boost to the Hot Water.<br />
<br />
I tried several MQTT apps and found the one I liked the most was <a href="https://play.google.com/store/apps/details?id=net.routix.mqttdash&hl=en_GB" target="_blank">MQTT dash</a> it let me create quite a nice interface.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirS0Di8O260vZS-fz1sPw58H35XLNsI1l_rZBzkdF5P-a8Oaa_92px7A6CFf8RQ2CLyaR2m6Ahm8AycHPUD4qzZDF7OhZYee9TZkRAw4vEurKAzTF1P1xunb3G1oCLz3NgfMayP9eVPKY/s1600/MQTT+Dash.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirS0Di8O260vZS-fz1sPw58H35XLNsI1l_rZBzkdF5P-a8Oaa_92px7A6CFf8RQ2CLyaR2m6Ahm8AycHPUD4qzZDF7OhZYee9TZkRAw4vEurKAzTF1P1xunb3G1oCLz3NgfMayP9eVPKY/s320/MQTT+Dash.jpg" width="180" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 12.8px;">Sample layout for MQTT Dash</td></tr>
</tbody></table>
Another one I liked was MQTT Dashboard because this has widgets that you can have on you phone desktop to switch something on or off without opening the app first (Android only, I think).<br />
<br />
So all was going well and starting to work when I saw that the lovely people that make the Raspberry Pis had just launched a new version of the Pi Zero, this time with WiFi and Bluetooth included and it was just under £10 .....Whoa! .... hold on a minute! under a tenner! .... I'm quite prepared to use a Pi Zero W instead of a Wemos D1 mini and shut it in the airing cupboard controlling the hot water.<br />
<br />
The Pi Zero isn't very fast but I was certain it was plenty fast enough to control one relay and read the temperature using a DS18B20.<br />
<br />
So I changed plans at this point a turned toward the Pi Zero W, if you want to use an ESP8266 then go over to Github and use arendst's code (I use it on 3 Sonoffs) and make it happen.<br />
<br />
I will put together a blog entry for the Pi Zero W in a few days, I'm just sorting out the housing and wiring to put it in the airing cupboard.<br />
<br />
As usual if there are any questions just ask them in the comments and I'll do my best to answer them.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com1tag:blogger.com,1999:blog-4455987088008622536.post-89404852283142363692017-01-15T17:47:00.004+00:002022-07-20T14:47:03.403+01:00DIY Chrono Mark IIWell it's been a long time since I started off this project and I've made a few changes along the way and a few people have had a go at making their own Chronos based on the entries in this blog, some followed the design and some incorporated elements of their own into the design to improve it.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZEtR_MTcczDN9tjFAjwDbydgV202NA3JviJtDHEhELLZdcOSQgmHpxLsuvPKbHCJwtvKBC6eWUUdhIYt3QWE1k8ndoCGLatKFfSI_FJLKGZcHFv2CK-__OwV1GgPJGIHywCDeIxIv3go/s1600/Chrono+assembled.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="217" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZEtR_MTcczDN9tjFAjwDbydgV202NA3JviJtDHEhELLZdcOSQgmHpxLsuvPKbHCJwtvKBC6eWUUdhIYt3QWE1k8ndoCGLatKFfSI_FJLKGZcHFv2CK-__OwV1GgPJGIHywCDeIxIv3go/s400/Chrono+assembled.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Chrono Mark II Assembled</td></tr>
</tbody></table>
There were a couple of the things I wasn't keen on with my design: -<br />
<ul>
<li>The fact that it was not a round tube but a teardrop and therefore may not always line up with the rifle and look a bit odd.</li>
<li>An external charger circuit was required to charge the internal battery.</li>
<li>The switch was mounted at the other end of the tube from the electronics and was a bit of a pain to wire up and assemble.</li>
</ul>
So along came the Mark II with the intention of improving on those issues.<br />
<br />
The main reason for the teardrop design was to fit in the electronic modules with the central tube so I needed to come up with a design where I could place the modules and battery around the perimeter of the tube whilst keeping the overall diameter as small as possible.<br />
<br />
I also wanted to add a charging circuit inside the tube so there was only one part to worry about so you could just plug it into a phone charger to charge it. If I could get all this inside the tube, along with a switch located at the same end as the electronics then it would be a big improvement IMO.<br />
<br />
First test was putting the modules around the tube .... using Tinkercad I messed around with all the modules trying to fit them in.<br />
<br />
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikXjHunbnZTqLvOqYUNN51rR9vTTqR9X8CmyIXavg0ousNwIRwl0KbMJZH_LxEgy5r7B5Y3Gb0Cgy4AgJ8zk9PgCUx4uNQ3SJdibi7BiDkctni6PgV_jd4hZ47BiPYByVrfTtOuAd81cE/s1600/Chrono+MkII+TCAD+Layout+2.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikXjHunbnZTqLvOqYUNN51rR9vTTqR9X8CmyIXavg0ousNwIRwl0KbMJZH_LxEgy5r7B5Y3Gb0Cgy4AgJ8zk9PgCUx4uNQ3SJdibi7BiDkctni6PgV_jd4hZ47BiPYByVrfTtOuAd81cE/s320/Chrono+MkII+TCAD+Layout+2.jpg" width="320" /> </a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZSswDluO42HIVjYWXPipkdXkMGkzhswMiibEDjT5TzO8XV1SzYTn23GkP47fImzonb8ybr_oqGq4k7AMDNvPwajr1vEaUNFEjdc23j4yCYD0qcJtMw5VOQthz8eW9tOsTG2DPsYvLKCQ/s1600/Chrono+MkII+TCAD+Layout.jpg" style="clear: right; display: inline; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZSswDluO42HIVjYWXPipkdXkMGkzhswMiibEDjT5TzO8XV1SzYTn23GkP47fImzonb8ybr_oqGq4k7AMDNvPwajr1vEaUNFEjdc23j4yCYD0qcJtMw5VOQthz8eW9tOsTG2DPsYvLKCQ/s320/Chrono+MkII+TCAD+Layout.jpg" width="284" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Having got them to all fit in a round base I set about figuring out the charging the battery and powering the Nano from the 3.6V battery as the IR receivers were specified to use 5V.<br />
<br />
After a good Googling around for some modules I finally found some modules that fit the bill, one to convert 3.6V to 5V and another to charge a single lithium cell from 5V. These module need to be pretty small and I wanted them to be on a single PCB to make wiring up the modules easy so I designed a PCB to mount them on and had the idea to attach the PCB to the switch which would be securely screwed in to the base.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQFLxmf9XAyz2dna_nH_O0DDYRJ61G3CG2RrNRMPY3n2NwrziEePlmPhW9TYBU7-AxjYi45mEk1OOWiLlXXiYd89FsEnwPr70yMw2_HVvmkA1bN-jSA0YX_NKhVP7kmTX0W1AEGFo3lF4/s1600/Power+PCB+circuit.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="263" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQFLxmf9XAyz2dna_nH_O0DDYRJ61G3CG2RrNRMPY3n2NwrziEePlmPhW9TYBU7-AxjYi45mEk1OOWiLlXXiYd89FsEnwPr70yMw2_HVvmkA1bN-jSA0YX_NKhVP7kmTX0W1AEGFo3lF4/s320/Power+PCB+circuit.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Power PCB Circuit</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhapESlT6l609gL-w4KM77HBfP2qS1O1TkSgm549jv1MhyphenhyphencsAud9ytZspq45AYAfLut-7MrNxM38l3v5Z7-4oBSFT9ZkP5mAfNGy4yPIHBNQRfDmesdv6Q7b5jDp8i-eIwIOXBy6Wjnpqo/s1600/Chrono+LED+pwr+PCB.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhapESlT6l609gL-w4KM77HBfP2qS1O1TkSgm549jv1MhyphenhyphencsAud9ytZspq45AYAfLut-7MrNxM38l3v5Z7-4oBSFT9ZkP5mAfNGy4yPIHBNQRfDmesdv6Q7b5jDp8i-eIwIOXBy6Wjnpqo/s400/Chrono+LED+pwr+PCB.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Design layout</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXWu59vZnwaT8a2Ow91b8WsOn_SnRy6xGOVHRyk6EccLTHT4aWHPy9fP3mK2Xa6KYnVC6TnLKeg0dri_d8tzcLuD-deRuGMSc63pLr-q2_IVzIwiZo3PknMnQS15zCf_14-0g5ArveiAk/s1600/PowerPCB+layout.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="201" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXWu59vZnwaT8a2Ow91b8WsOn_SnRy6xGOVHRyk6EccLTHT4aWHPy9fP3mK2Xa6KYnVC6TnLKeg0dri_d8tzcLuD-deRuGMSc63pLr-q2_IVzIwiZo3PknMnQS15zCf_14-0g5ArveiAk/s400/PowerPCB+layout.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Final PCB</td></tr>
</tbody></table>
The outcome for this design means that when switched on the 3.6V battery is connected to the DC/DC converter supplying 5V to the Nano, BT module and the IR beams, when switched off the battery changes to the output of the single cell charger module, which gets it's 5V supply from the nano USB connector therefore charging the battery. Also all the supply connections for the modules are also on the PCB making it easier to wire up when assembling.<br />
<br />
<h2 style="text-align: center;">
Some More Images</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpBvFrTIgxs9_q8UmXnCQ8gPU4_aBkGnXru2dLaMsOuJCXJC73u9QjzHRMjdOHkH1AG9VGZM1RSDDsRoVCvrU_a4qgUWR97n4mTkmfK5bg42Poni5YHSY4GH1xQSsGtMVxRpxmSRNXowU/s1600/chrononMk2+2.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpBvFrTIgxs9_q8UmXnCQ8gPU4_aBkGnXru2dLaMsOuJCXJC73u9QjzHRMjdOHkH1AG9VGZM1RSDDsRoVCvrU_a4qgUWR97n4mTkmfK5bg42Poni5YHSY4GH1xQSsGtMVxRpxmSRNXowU/s320/chrononMk2+2.jpg" width="304" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK0BthQ2bz26qap2FF4hgtxhBJp30DvLnzGK0p_CbppMytL8-aD1r8mf2KwgYeHZ6NaDjeVmlohiNJcDC03tqMJvHyO0OPtuPnvaNr8HsVWRM86FIcpFjM0dM-2MV7dvXOXHdKYath3hg/s1600/chrononMk2+1.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK0BthQ2bz26qap2FF4hgtxhBJp30DvLnzGK0p_CbppMytL8-aD1r8mf2KwgYeHZ6NaDjeVmlohiNJcDC03tqMJvHyO0OPtuPnvaNr8HsVWRM86FIcpFjM0dM-2MV7dvXOXHdKYath3hg/s320/chrononMk2+1.jpg" width="150" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWukN50kmLdwzjjXZa7BGO_EsJfMjv1MI3qrGbifcD5Rcqyzk-k2gLdQIDfGneYtDFsPPAdH79ENnfnnMmZxdDjpJAJ7UmAgJB7DDbdD1qBCpHkUE7HWIm29NMW9K0sYk4IQBlIqJdCa0/s1600/Chrono+MkII+1.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWukN50kmLdwzjjXZa7BGO_EsJfMjv1MI3qrGbifcD5Rcqyzk-k2gLdQIDfGneYtDFsPPAdH79ENnfnnMmZxdDjpJAJ7UmAgJB7DDbdD1qBCpHkUE7HWIm29NMW9K0sYk4IQBlIqJdCa0/s320/Chrono+MkII+1.jpg" width="232" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqE3Fbkth85nTM7DQFuCBAmZFJWcADLJcidNujfSF1gpsI5GNRyfSwZMVN_3O640u_qJhIaMf4F4TpT3gGfUfOQqw0Rr_TGyxBmSXdcQlhP4SUWwKGPM_RwTyp4dyHWy68OwX8WUENgB8/s1600/Chrono+MkII+2.jpg" style="clear: right; display: inline; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqE3Fbkth85nTM7DQFuCBAmZFJWcADLJcidNujfSF1gpsI5GNRyfSwZMVN_3O640u_qJhIaMf4F4TpT3gGfUfOQqw0Rr_TGyxBmSXdcQlhP4SUWwKGPM_RwTyp4dyHWy68OwX8WUENgB8/s320/Chrono+MkII+2.jpg" width="207" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5IYnAR3IKoPJ7Uiv9iH1876XCqkaxUgZLhgugcXGIEMqmQmlAGtDwVJiTzPd9qt_9740iQfWVm64rBybTNAWREcBauXFNbsZf6N4LT4kqF-nl_SvBp8uLy-KgSCCFFYWCZyxq6dt9qH4/s1600/Chrono+MkII+3.jpg" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5IYnAR3IKoPJ7Uiv9iH1876XCqkaxUgZLhgugcXGIEMqmQmlAGtDwVJiTzPd9qt_9740iQfWVm64rBybTNAWREcBauXFNbsZf6N4LT4kqF-nl_SvBp8uLy-KgSCCFFYWCZyxq6dt9qH4/s320/Chrono+MkII+3.jpg" width="226" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMUIfLVjr_s482zssvG26LdckcgTREDVxLGHCYN8n7II8oN7b5VjtrDbQCDeyFeuKWezjaJgoyWWD6dWlHySxO40Lf2w_RwqUcnPCcmsWyfW_94Vqt5iZMgS0bqVqT3UNCamB4Lo-sT8w/s1600/Chrono+MkII+4.jpg" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMUIfLVjr_s482zssvG26LdckcgTREDVxLGHCYN8n7II8oN7b5VjtrDbQCDeyFeuKWezjaJgoyWWD6dWlHySxO40Lf2w_RwqUcnPCcmsWyfW_94Vqt5iZMgS0bqVqT3UNCamB4Lo-sT8w/s320/Chrono+MkII+4.jpg" width="207" /></a><br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Things you'll need<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table 0="" 1px="" align="left" border-style:="" border-width:="" border="1" solid="" style="border-color: rgb(128, 128, 128);">
<tbody>
<tr>
<td><b> Item</b></td>
<td><b>Link </b></td>
<td><b>Cost </b></td>
</tr>
<tr>
<td> Pololu 5V Step-Up Voltage Regulator U3V12F5</td>
<td><a href="https://www.proto-pic.co.uk/pololu-5v-step-up-voltage-regulator-u3v12f5.html" target="_blank">Link</a></td>
<td> £3.32</td>
</tr>
<tr>
<td> DD08CRMA Mini 5V 1A Lithium LiPo Charger Module</td>
<td><a href="http://www.ebay.co.uk/itm/DD08CRMA-Mini-5V-1A-Lithium-LiPo-Charger-Module-for-Arduino-Breadboard-/401139901385?hash=item5d65cd23c9%3Ag%3ACAkAAOSwzJ5XXRIY" target="_blank">eBay Link</a></td>
<td> £1.97</td>
</tr>
<tr>
<td> Mini Miniature On/On 6 Pin Slide Switch DPDT</td>
<td><a href="http://www.ebay.co.uk/sch/i.html?_from=R40&_trksid=p2047675.m570.l1313.TR0.TRC0.H0.XMiniature+On%2FOn+6-Pin+DPDT+Slide+Switch.TRS0&_nkw=Miniature+On%2FOn+6-Pin+DPDT+Slide+Switch&_sacat=0" target="_blank">eBay Search Link</a></td>
<td> ~£0.40 ea.</td>
</tr>
<tr>
<td> Power PCB gerber files</td>
<td><a href="https://www.dropbox.com/s/j5o4692ttbop37l/Chrono%20Power_LED%20board.rar?dl=0" target="_blank">Link</a></td>
<td> £0.00</td>
</tr>
<tr>
<td>3D Print files for carrier and tube</td>
<td><a href="https://www.dropbox.com/s/dytlyg7g4arzedg/3D%20Print%20files.rar?dl=0">Link</a></td>
<td>£0.00</td>
</tr>
</tbody>
</table>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
<br />
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com18tag:blogger.com,1999:blog-4455987088008622536.post-13027765699331079782016-06-06T20:47:00.000+01:002016-06-06T20:47:27.094+01:00New Android app for the Chrony F1I recently bought a damaged Chrony F1 from a chap that had accidentally shot it, it never ceases to amaze me how companies can design and sell things that by design you shoot at and not put adequate protection in front of the delicate electronics.<br />
<br />
The front casing had been hit and had a large dent in it that cracked the LCD and dented the crystal body, after a suggestion from John on the Facebook group "<span style="background-color: white; color: #1d2129; font-family: helvetica, arial, sans-serif; font-size: 14px; line-height: 18.6px; text-indent: 2px; white-space: pre;">SHOOTING CHRONOGRAPHS U.K.</span>" I looked at Radio spares for a replacement and bought this screen <a href="http://uk.rs-online.com/web/p/lcd-monochrome-displays/1847715/?searchTerm=1847715&relevancy-data=636F3D3126696E3D4931384E525353746F636B4E756D6265724D504E266C753D656E266D6D3D6D61746368616C6C26706D3D5E5C647B367D247C5E5C647B377D247C5E5C647B31307D2426706F3D313426736E3D592673743D52535F53544F434B5F4E554D4245522677633D4E4F4E45267573743D31383437373135267374613D3138343737313526" target="_blank">184-7715</a>, it worked like a charm and after a bit of panel beating and a lick of Hammerite Dark Green paint it looked as good as new.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaA7yBpWt-m2hewZylrl-zWJHVcdUStEyNJnk_UCNlXZy2Y60zG5RrgXjZFWdFX7b_Bx30JBNAzlxie0DfU6tIcfTFvTn6Olqc6VTJwO-8w5u5jvv20QYVeyMSj834ysDjNtBlrZTwGVI/s1600/chrony+F1+before+and+after.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaA7yBpWt-m2hewZylrl-zWJHVcdUStEyNJnk_UCNlXZy2Y60zG5RrgXjZFWdFX7b_Bx30JBNAzlxie0DfU6tIcfTFvTn6Olqc6VTJwO-8w5u5jvv20QYVeyMSj834ysDjNtBlrZTwGVI/s320/chrony+F1+before+and+after.jpg" width="293" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Before and after</td></tr>
</tbody></table>
One other thing I did before shooting at it was to buy some 10mm Acrylic sheet from <a href="http://www.ebay.co.uk/itm/111748519041?_trksid=p2057872.m2749.l2649&var=410744756517&ssPageName=STRK%3AMEBIDX%3AIT" target="_blank">eBay</a> to make some clear shields to protect the display and the rear sensor block.<br />
<br />
So when I started to use it I realised that I'd have to write down the readings and calculate the power myself later ..... s*d that! surely there's an app for that, if not I'll write one.<br />
<br />
So I created an app to record the readings after each shot with the option to speak the value if you prefer and automatically calculate the power using the pellet weight you entered.<br />
<br />
I also learned of a secondary Android market called Aptoide, to which I added some of my apps so they can be downloaded from one place.<br />
<br />
The link to my store is <a href="http://gadjetware.store.aptoide.com/">http://gadjetware.store.aptoide.com/</a> there are other apps there as well, if you think it's worth it buy me a beer using the beer icon :-) and I might add more features.<br />
<br />
I found the serial communication protocol for the Chrony F1 and when I get a chance I'm going to look into adding the Chrony remote functionality to my PC software and maybe make a Bluetooth interface so your phone can talk to it.Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com2tag:blogger.com,1999:blog-4455987088008622536.post-60829677047642834482016-06-06T20:19:00.000+01:002016-06-06T20:19:29.091+01:00DIY Chronograph Accuracy testingA few people have attempted the DIY chronograph build, at least one person improved the design and made an excellent version of his own.<br />
<br />
I had a a question asked about the accuracy of the chronograph so I setup some testing over the weekend to try and determine if it was as accurate as others out there.<br />
<br />
I don't have access to a calibrated air rifle or similar, if something like that even exists?? so I decided to use a good quality Oscilloscope (Picoscope automotive), which connected to my laptop via USB and do a comparison with the output from the Nano (in uSeconds).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5TJ_kcErpzYCncj-SfrWqu-sbGN1kVDGYR6OIZRN3WaXH911zjKUKCAgsqHpQdYTEf4ShdXhEG5l_kz_7w-R52YV1mpOLC8BXwxWI_tgDObSzT6m6yIGc58ajCG2LMgC7AbGVcCbwdpw/s1600/Chrono+accuracy+data+overview.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="374" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5TJ_kcErpzYCncj-SfrWqu-sbGN1kVDGYR6OIZRN3WaXH911zjKUKCAgsqHpQdYTEf4ShdXhEG5l_kz_7w-R52YV1mpOLC8BXwxWI_tgDObSzT6m6yIGc58ajCG2LMgC7AbGVcCbwdpw/s640/Chrono+accuracy+data+overview.jpg" width="640" /></a></div>
<br />
For each measurement I took a screenshot of the waveform from the Oscilloscope and the serial data from the Nano, this shows the correlation between the actual time between the first beam being broken and the second.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
There is also a google sheet showing the data that was recorded during the test <a href="https://docs.google.com/spreadsheets/d/1D2qcZ736PvihWdPM4fhMbHL1OzcPQep8IwUvm3pErms/edit?usp=sharing" target="_blank">here</a> you can view the data and make your own decisions, for the last few shots I added a Chrony F1 about 3m away from the rifle to see what result that gave me.<br />
<br />
The Chrony was set up in the garage with the lights off (florescent's) because the Chrony doesn't like florescent lights, instead I had a couple of cheap battery powered LED lights on top of the diffusers.<br />
<br />
The conclusion is that although the data for each shot was different between the oscilloscope and Nano, over the 23 shots the average from both was exactly the same 10.57 ftLbs, this compares well to the 10.48 ftLbs when I had it checked at a shop a couple of years ago.<br />
<br />
So I'm happy to use my DIY chrono with the understanding that there's always margin for variation and if I was getting 11.9 ftLbs that would be too close for comfort but 11.5 would give me 4% 'ish headroom.<br />
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com8tag:blogger.com,1999:blog-4455987088008622536.post-59828875777501421352016-05-19T23:13:00.002+01:002017-05-17T12:13:47.622+01:00Updated PC software for the DIY Chrono (and Combro)Just a quick update for anyone that has tried the PC software application for my DIY Chrono before, I've re-worked it a bit and changed the layout and moved the settings to a separate screen.<br />
<br />
Also now I've fixed the Combro option not working so it should now report the correct values, if not please let me know as I don't own a Combro ..... the whole point in making my own.<br />
<br />
<h4>
Some Screen shots ...</h4>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3Rqlpjbcz3bhCYRBg-VRdwIDnDEhQrWv4-G5xhGriIBlT3Xmn9i5cVHrxehWSNQQND8hnZndRZn6wyktyyPchqr9ANEddEcM264Qj8qVCTKNVvqC3QhqTa1jcXhlkCmglGv2kBeqMxoM/s1600/PC+Chrono+SW+1.2+Main.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="314" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3Rqlpjbcz3bhCYRBg-VRdwIDnDEhQrWv4-G5xhGriIBlT3Xmn9i5cVHrxehWSNQQND8hnZndRZn6wyktyyPchqr9ANEddEcM264Qj8qVCTKNVvqC3QhqTa1jcXhlkCmglGv2kBeqMxoM/s320/PC+Chrono+SW+1.2+Main.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Main screen interface</td></tr>
</tbody></table>
The main screen shows all the shot details in FPS and M/S along with a min FPS, max FPS and a Delta FPS.<br />
<div>
On the right there is a list that adds each shot's data to a row so you can see the history.<br />
<div>
At the bottom is a chart section that, if the checkbox is checked, shows the data graphically, there is a tab for FPS and one for energy.</div>
<div>
You can also select the option to store the shot data to a file on the PC, the path is set automatically but you can type in your own. The data is stored as a CSV file and can be opened by excel and used to create a graph.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil9f9GEdWezySZ3zhaP_wy_aZFiqqQWEKE1srXjJiSKItIo2qUSHE1dPfZ4j3Kqpg_dSYzZWnrUTvkZgC_6FcJMDP4lfjqL3fBKsn_QTEbktCeCOGFiqSROzt3gp2KnWZgndyZnDa3dj8/s1600/PC+Chrono+SW+1.2+Settings.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="305" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil9f9GEdWezySZ3zhaP_wy_aZFiqqQWEKE1srXjJiSKItIo2qUSHE1dPfZ4j3Kqpg_dSYzZWnrUTvkZgC_6FcJMDP4lfjqL3fBKsn_QTEbktCeCOGFiqSROzt3gp2KnWZgndyZnDa3dj8/s320/PC+Chrono+SW+1.2+Settings.JPG" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Settings screen</td></tr>
</tbody></table>
The settings screen is self explanatory, I hope, change the settings and they are stored for next time, the pellet data etc. is stored in the CSV file as well. If you have a Combro then tick the checkbox and the software should work for you as well<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs3QwOMwb8YgCaNjLTx50FpNwP3-tl_FvAywlIU51R2NhsUakxmktt99XzvhB40C_xswjNzdwWcK0euFJ6v8N7EYk2pEUIGezoj1_7MrWni4qXq0Gy46EANazT99rqHnI6FO1XwVxKEqc/s1600/PC+Chrono+SW+1.2+Beeps.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs3QwOMwb8YgCaNjLTx50FpNwP3-tl_FvAywlIU51R2NhsUakxmktt99XzvhB40C_xswjNzdwWcK0euFJ6v8N7EYk2pEUIGezoj1_7MrWni4qXq0Gy46EANazT99rqHnI6FO1XwVxKEqc/s1600/PC+Chrono+SW+1.2+Beeps.JPG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Here you can set the PC to make a noise</td></tr>
</tbody></table>
You can set the PC to give you an audible warning every 'n' shots, this is good for knowing when you fired your last shot and you're not looking at the screen, the other check box resets the shot count after the beep.</div>
<div>
<br /></div>
<div>
You can download the file from <a href="https://www.dropbox.com/s/ikbdk0k3bf9lx7w/PC%20Chrongraph%201.30.rar?dl=0" target="_blank">here</a> unpack the rar file and run the setup to install.</div>
<div>
<br /></div>
<div>
Comments and feedback always welcome and if you like buy me a pint with the donate button.<br />
<br /></div>
</div>
Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com8tag:blogger.com,1999:blog-4455987088008622536.post-64768902209608586112016-05-15T16:38:00.000+01:002016-05-15T16:38:35.175+01:00Chronograph - Another optionAfter printing the last model I ran out of the white filament and decided to give the black filament a try and was surprised to get a print that looks and feels a better print, I think it's an optical illusion though, black just seems to look better.<br />
<br />
Anyway I decided to do another design of the enclosure one without the battery for those that just want to connect to their laptop via the USB cable and us the PC software from elsewhere in my blog.<br />
<br />
This design is a bit smaller that the first as there is no battery, switch or charging cable, I did leave in the holder for the Bluetooth module so it can be used with the smartphone app but you will need to power it from one of those portable emergency batteries via a USB cable.<br />
<br />
You can get the STL files from <a href="http://www.thingiverse.com/thing:1564377" target="_blank">Thingiverse</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqAdDeIMty9TErpfD9UjwelxWBks_FThyLwioM37Ix05JFbS_rxfOh72ljQib1brKIHnV1HcS5LEfpC7oOGs1Roea8XjxGZ90yIE9Kit4aOtKIAg1Lwamv6cNV9nmfAWR94SBXmzx65vE/s1600/2016-05-15+10.15.44.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="185" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqAdDeIMty9TErpfD9UjwelxWBks_FThyLwioM37Ix05JFbS_rxfOh72ljQib1brKIHnV1HcS5LEfpC7oOGs1Roea8XjxGZ90yIE9Kit4aOtKIAg1Lwamv6cNV9nmfAWR94SBXmzx65vE/s320/2016-05-15+10.15.44.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSmHtOm-l7Nvd1FdvO2-N0j8vqPo5cGqf7gZuG8tCI2vf3FwV9uMf16wD9g4XkiD7AU9ZLuRYwuEPdKD3Ny4TiY3iUn-Nn4QBtCMiOPEoiOIZaLsu9dHQQKgnTC0RFrZLTvohcJGjqFZw/s1600/2016-05-15+10.15.33.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSmHtOm-l7Nvd1FdvO2-N0j8vqPo5cGqf7gZuG8tCI2vf3FwV9uMf16wD9g4XkiD7AU9ZLuRYwuEPdKD3Ny4TiY3iUn-Nn4QBtCMiOPEoiOIZaLsu9dHQQKgnTC0RFrZLTvohcJGjqFZw/s320/2016-05-15+10.15.33.jpg" width="320" /></a></div>
<br />
I've also been making some changes to the Arduino sketch to improve the functionality, I've implemented the use of interrupts to trigger the measurements so that some other things can be done via the main loop like checking if the trigger beams are blocked.<br />
<br />
Some other options may be possible like adding and SD card to store shot data internally and use you PC later to recover the shot data for analysis, If you use a long enough piece of aluminium you could add a thread to the end to fit you silencer to and just use you gun for the day and download the shot data later.Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com7tag:blogger.com,1999:blog-4455987088008622536.post-25857875335510801782016-05-09T20:11:00.002+01:002022-07-20T18:32:07.333+01:00Chronograph completed - FinallyAs anyone who's read this blog before will know, there's a common theme throughout, the DIY Chronograph I made for measuring the speed of an airgun pellet.<br />
<br />
Well since getting a 3D printer I've finally managed to finish off the project and put it in a case, it's not often I actually put things in a nice case.<br />
<br />
The first case with the Nokia display, it was a bit clunky and easy to break, when I dropped it that is!<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHftowsDrnYL-MEdTAzihFcfduA0P7GLVKVwzRHZoef6udgloYNNFLfRPF-J8nQ6zHNnOuyXafotLrAzaJG7PVa9sBO0dLNMv4EhlqQey4rCgGeOz8jJCJk0ITfBvupCbr0shtQaeMDLk/s1600/Nokia+case+1.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHftowsDrnYL-MEdTAzihFcfduA0P7GLVKVwzRHZoef6udgloYNNFLfRPF-J8nQ6zHNnOuyXafotLrAzaJG7PVa9sBO0dLNMv4EhlqQey4rCgGeOz8jJCJk0ITfBvupCbr0shtQaeMDLk/s320/Nokia+case+1.jpg" width="320" /></a></div>
<br />
Second attempt, this is the one I've been using. This one uses the Bluetooth module to talk to an app on the phone <a href="http://gadjetsblog.blogspot.co.uk/2013/07/finally-diy-chronograph-meets-android.html" target="_blank">here</a><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKGY9cQqiZ2TJ4gbCvEpkmDegQS4XACQY0axfnUqTmieaYmViBaFV3O3MFFtdNE_OfN35e_WkZVboiF1uJlcw-Ar_SJMKh-UwRcGLAd2VDiu3KWbAUzOhWggSy5YPUvqAouzP7wHeg-y4/s1600/ChronoBT.png" style="margin-left: auto; margin-right: auto;"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKGY9cQqiZ2TJ4gbCvEpkmDegQS4XACQY0axfnUqTmieaYmViBaFV3O3MFFtdNE_OfN35e_WkZVboiF1uJlcw-Ar_SJMKh-UwRcGLAd2VDiu3KWbAUzOhWggSy5YPUvqAouzP7wHeg-y4/s400/ChronoBT.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Collection of bits held together with heatshrink</td></tr>
</tbody></table>
The final one, this one contains all the gubbins from the shot above inside the cover.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1VAhQw_Lp3RatM8N6MiUKRAu657TOLvUOKioZlyUadozYszBG0R_y2b5kmKHpz5R3a-mvaM0hSh6ZQc12cLtIbe4v9XAfSjH3SwaDtavVgohHyDXiKjHpcIgwGNlTOTDET9mycn2Kh6U/s1600/2016-05-07+20.21.02.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1VAhQw_Lp3RatM8N6MiUKRAu657TOLvUOKioZlyUadozYszBG0R_y2b5kmKHpz5R3a-mvaM0hSh6ZQc12cLtIbe4v9XAfSjH3SwaDtavVgohHyDXiKjHpcIgwGNlTOTDET9mycn2Kh6U/s320/2016-05-07+20.21.02.jpg" width="180" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpXNOHPk1ow9sj1KAQrr6s97pPHCF85ADOnGWSjAvBijTr091JB3Mavwbq_dIuMz6era8bm1GDm9Nl9oo2mJJl8QUFPjF3YvA6AxQi7E84Hnwr3-U22OV-BBQESMdxrjsUXhnHwFJWFHA/s1600/2016-05-07+20.20.40.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpXNOHPk1ow9sj1KAQrr6s97pPHCF85ADOnGWSjAvBijTr091JB3Mavwbq_dIuMz6era8bm1GDm9Nl9oo2mJJl8QUFPjF3YvA6AxQi7E84Hnwr3-U22OV-BBQESMdxrjsUXhnHwFJWFHA/s320/2016-05-07+20.20.40.jpg" width="180" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The end that screws on with the USB connector below and the front<br />
view with the on/off switch and battery charge connector</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN070DzllTzr0pCbvf5GGCmTaRJdOXzncORHnr2Mh9PdE4_ozqwdUrU7eOM6JK1WkwRasjMrd5Rzh6KCmv7i6QSP9CL-fbnN8u-dSrGzw3D5Q0h414M6JROPlo5F-CxPRdysEeNHwia2U/s1600/2016-05-07+20.21.32.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN070DzllTzr0pCbvf5GGCmTaRJdOXzncORHnr2Mh9PdE4_ozqwdUrU7eOM6JK1WkwRasjMrd5Rzh6KCmv7i6QSP9CL-fbnN8u-dSrGzw3D5Q0h414M6JROPlo5F-CxPRdysEeNHwia2U/s320/2016-05-07+20.21.32.jpg" width="180" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Side View</td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: left;">
This one uses the Bluetooth adapter and connects to an app on the phone and has an internal lithium Ion battery than can be recharged using an external supply and charging module, you can leave out the battery and use the USB connector of the Nano to power the chronograph from your laptop or a battery pack with a USB power output. (if you do this then the switch doesn't do anything)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The enclosure is essentially two parts, a carrier, that holds all the electronics and a slide on cover.</div>
<div class="separator" style="clear: both; text-align: left;">
Both parts are a push fit onto the aluminium tube (16mm Dia. x approx 100m long)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Parts list: -</div>
<table border="1" style="width: 100%;">
<tbody>
<tr>
<td><h3>
<b>Item</b></h3>
</td>
<td><h3>
<b>Source</b></h3>
</td>
<td><h3 style="text-align: center;">
<b>Approx. cost</b></h3>
</td>
</tr>
<tr>
<td>3D printed enclosure - <a href="http://www.thingiverse.com/thing:1549916" target="_blank">Thingiverse</a></td>
<td>www.3dhubs.com<br />
www.shapeways.com</td>
<td>£10 - £20</td>
</tr>
<tr>
<td>Arduino Nano (could be mini pro etc.)</td>
<td>Ebay</td>
<td>£2</td>
</tr>
<tr>
<td>Slide switch</td>
<td>Ebay</td><td>£2</td>
</tr>
<tr>
<td>Battery (Turnigy Nano-Tech 600mah 1S 3.7v 35-70C Lipo E-Flite)</td>
<td>Ebay</td>
<td>£5</td>
</tr>
<tr>
<td>Aluminium Tube - 16mm OD</td>
<td>Ebay</td>
<td>£5</td>
</tr>
<tr>
<td>Bluetooth Module</td>
<td>Ebay</td>
<td>£4</td>
</tr>
<tr>
<td>3V to 5V converter (NCP1402-3.3V STEP-UP BREAKOUT)</td>
<td>Proto Pic</td>
<td>£4</td>
</tr>
<tr>
<td>JST wired plug connector</td>
<td>Ebay</td>
<td>£3 for 10 off</td>
</tr>
<tr>
<td>IR Emitter x 2<br />
<br />
<br /></td><td><span face=""arial" , "helvetica" , sans-serif" style="color: #771000; font-size: 14.85px; line-height: 14px; text-decoration: none;"><a href="http://www.ebay.co.uk/itm/OPTEK-TECHNOLOGY-OP240A-IR-EMITTING-DIODE-/171011934718" style="color: #771000; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 14.85px; line-height: 14px; text-decoration: none;" target="_blank">Ebay</a><br /><span face=""arial" , "helvetica" , sans-serif" style="color: #771000; font-size: 14.85px; text-decoration: none;"><a href="http://uk.farnell.com/jsp/displayProduct.jsp?sku=1703551&CMP=KNC-GUK-FUK-GEN-SKU-DGA&mckv=sZ1UYoTKv|pcrid|14887380429|kword|op240a.|match|p|plid|" style="color: #771000; font-size: 14.85px; text-decoration: none;" target="_blank">Farnell</a><br /><a href="http://uk.rs-online.com/web/p/ir-leds/1713858/?searchTerm=OP240A&relevancy-data=636F3D3226696E3D4931384E4B6E6F776E41734D504E266C753D656E266D6D3D6D61746368616C6C7061727469616C26706D3D5E5B5C772D5C2E2F252C5D2B2426706F3D313326736E3D592673743D4D414E5F504152545F4E554D424552267573743D4F50323430412677633D424F544826" style="color: #771000; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 14.85px; text-decoration: none;" target="_blank"><span face=""arial" , "helvetica" , sans-serif">RS Components</span></a></span></span></td>
<td><br />
<br />
RS= £2.25, 5 off</td>
</tr>
<tr>
<td>IR Detector x 2</td>
<td><a href="http://www.ebay.co.uk/itm/OPTEK-TECHNOLOGY-OPL550A-PHOTO-SENSOR-LATERAL-TM-BTP-/181108011067?_trksid=p3284.m263&_trkparms=algo%3DSIC%26its%3DI%26itu%3DUCI%252BIA%252BUA%252BFICS%252BUFI%26otn%3D21%26pmod%3D181108010897%26ps%3D54" style="color: #cc4411; font-family: Arial, Helvetica, sans-serif; font-size: 14.85px; line-height: 20.79px;" target="_blank">Ebay</a><br />
<a href="http://uk.farnell.com/optek-technology/opl550a/photo-sensor-lateral-tm-btp/dp/1678676" style="background-color: white; color: #771000; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; line-height: 20.79px; text-decoration: none;" target="_blank"><span face=""arial" , "helvetica" , sans-serif">Farnell</span></a><br />
<a href="http://uk.rs-online.com/web/p/phototransistors/4557954/?searchTerm=opl55&relevancy-data=636F3D3226696E3D4931384E4B6E6F776E41734D504E266C753D656E266D6D3D6D61746368616C6C7061727469616C26706D3D5E5B5C772D5C2E2F252C5D2B2426706F3D313326736E3D592673743D4D414E5F504152545F4E554D424552267573743D6F706C35352677633D424F544826" style="background-color: white; color: #771000; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; line-height: 20.79px; text-decoration: none;" target="_blank"><span face=""arial" , "helvetica" , sans-serif">RS components</span></a></td>
<td>RS=£5, 5 off</td>
</tr>
<tr>
<td>Arduino Sketch</td><td><a href="https://1drv.ms/u/s!AkqVSEM4Y7kDhKxDGGMHsg87zSUM4w" target="_blank">Here</a></td>
<td>Free</td>
</tr>
<tr>
<td>Android App apk file (from Aptoide store)</td>
<td><a href="https://gadjetware.store.aptoide.com/app/market/appinventor.ai_gadjet0.Bluetooth_Chronograph_AI2/3/19136801/Bluetooth+Chronograph+Interface" target="_blank">Here</a></td>
<td>Free</td>
</tr>
</tbody></table>
<br />
So around £44 to put together, £24 'ish if you can 3D print your own enclosure.<br />
You could also do away with the battery and 3 to 5V converter if you powered it from you laptop USB or battery with a USB socket on it.<br />
<h3>
More images</h3>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1qNRSWj3zE15Y5NsKhJnAQM3cm4VMftQpPWYtF7qAyt65kwJOkIY5l5OA0oKvl8avwt7jbZLO0WU7SOxKd_dwLdykB85355Z8mMi5LU7LVbdGkJ-DCjE8DuyGzp1vYBcLKGcbJgLbu3I/s1600/2016-05-05+19.32.14.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1qNRSWj3zE15Y5NsKhJnAQM3cm4VMftQpPWYtF7qAyt65kwJOkIY5l5OA0oKvl8avwt7jbZLO0WU7SOxKd_dwLdykB85355Z8mMi5LU7LVbdGkJ-DCjE8DuyGzp1vYBcLKGcbJgLbu3I/s320/2016-05-05+19.32.14.jpg" width="180" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Battery and PCB modules in place with the tube</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRPxaC3ZcxTLM_a5cUJFqgYiFu78SKOPJMIC_r5jpCuNlf4Q_xOYmBUuDN8vjnrho9238kz0SlIwExExdMJxmKF1nRgk25BlRlLmwFwsT4d99lcVnAV1qc1MK472WnOgyAQ9NJwB7ot7I/s1600/2016-05-05+19.33.37.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRPxaC3ZcxTLM_a5cUJFqgYiFu78SKOPJMIC_r5jpCuNlf4Q_xOYmBUuDN8vjnrho9238kz0SlIwExExdMJxmKF1nRgk25BlRlLmwFwsT4d99lcVnAV1qc1MK472WnOgyAQ9NJwB7ot7I/s320/2016-05-05+19.33.37.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Barrel end showing the USB connector</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq7kOFqv6qCgQgDzI3caEAsVYjdgHX9ljwBuUXMhzd9QdpohgCylJn-JyoJYDQm1skI5K2zmLdoeIJZN1gp0Dv3StUr4Q0ZjYMyJndLjufQziw5wHP7KsEP2ogE_R7_Ze5EekosCmw0Us/s1600/2016-05-06+14.35.32.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq7kOFqv6qCgQgDzI3caEAsVYjdgHX9ljwBuUXMhzd9QdpohgCylJn-JyoJYDQm1skI5K2zmLdoeIJZN1gp0Dv3StUr4Q0ZjYMyJndLjufQziw5wHP7KsEP2ogE_R7_Ze5EekosCmw0Us/s320/2016-05-06+14.35.32.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Front end showing on/off switch fitted</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja1GRNmy_GZSmFoswlOVVGjTs3e_r5YsUioRurrfT9HWxLi9_mh6aPc8aNE9CB0pZi9HCgIHWd173ltZipgAbwQVp8HH5sXMWszhThbbvrVJKNRPzV5cCu3TRrnRYBAMUmVbepvMyjvzo/s1600/2016-05-06+14.35.52.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja1GRNmy_GZSmFoswlOVVGjTs3e_r5YsUioRurrfT9HWxLi9_mh6aPc8aNE9CB0pZi9HCgIHWd173ltZipgAbwQVp8HH5sXMWszhThbbvrVJKNRPzV5cCu3TRrnRYBAMUmVbepvMyjvzo/s320/2016-05-06+14.35.52.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Inside the cover</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWMdK7RQgul-zIMRvZVQiEJ1_0QAbZJR5o-oBuYj6ive85i4kO16DhzsiiNorIfSrIYt4g7X1tYEgYwoxK1VQYc9PGgEACEcH1dt2Ei8x5GEJTiG1hP5Eyk2tc4OcmRk0MDEpwCiNpOYY/s1600/2016-05-06+16.02.21.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWMdK7RQgul-zIMRvZVQiEJ1_0QAbZJR5o-oBuYj6ive85i4kO16DhzsiiNorIfSrIYt4g7X1tYEgYwoxK1VQYc9PGgEACEcH1dt2Ei8x5GEJTiG1hP5Eyk2tc4OcmRk0MDEpwCiNpOYY/s320/2016-05-06+16.02.21.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The Bluetooth module wired to the Nano</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM3N03OnGtTf4Ou1J8zrxUHFuYYWHzByMKED1ARzttI_5g-Y40Jf18vMnoPGbejfM42iefbOcpr-2WGocQcp-3EBEvXuO7ih4QJHT0K8bekydHuamyR5sZ3BhbqtnZTfZcLyuNyDDYfcg/s1600/2016-05-06+16.05.08.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM3N03OnGtTf4Ou1J8zrxUHFuYYWHzByMKED1ARzttI_5g-Y40Jf18vMnoPGbejfM42iefbOcpr-2WGocQcp-3EBEvXuO7ih4QJHT0K8bekydHuamyR5sZ3BhbqtnZTfZcLyuNyDDYfcg/s320/2016-05-06+16.05.08.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Nano and BT module in the carrier</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1ap9ob8L2IXx_-0VL7xECvCorKffKLHj5kctca74A8HuR2n8lH0nQMr8WDUYKj67_fVPaBZRCoSb2zHlDbViGD7OdRXoExkpH34sYF6wywZ8iY7WPX6aU182uwfdXc23jMqgPaSE_tak/s1600/2016-05-07+19.29.33.jpg" style="margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1ap9ob8L2IXx_-0VL7xECvCorKffKLHj5kctca74A8HuR2n8lH0nQMr8WDUYKj67_fVPaBZRCoSb2zHlDbViGD7OdRXoExkpH34sYF6wywZ8iY7WPX6aU182uwfdXc23jMqgPaSE_tak/s320/2016-05-07+19.29.33.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Everything wired up... nearly. 3 to 5V converter top left under the battery</td></tr>
</tbody></table>
Tried and tested and working OK, the app works fine and I'm looking to add a graphing function so you can see the performance over a string of shots.<br />
<br />
Fritzing schematic<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiopgTh2q7UzgWoX5GDv8pijJ8yELj-dayNjzv25_iEOXChM-Tiz_lNVnyinpD2hak7GyiCm6QQPHoQGBJR-R5IRcuyYNoPSLuUfJPtwXhAg3fN-DauuMMNpLFTwD4JRqu0arARKiDDaDE/s1600/Arduino+Nano+Chronograph+7seg+1.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="337" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiopgTh2q7UzgWoX5GDv8pijJ8yELj-dayNjzv25_iEOXChM-Tiz_lNVnyinpD2hak7GyiCm6QQPHoQGBJR-R5IRcuyYNoPSLuUfJPtwXhAg3fN-DauuMMNpLFTwD4JRqu0arARKiDDaDE/s640/Arduino+Nano+Chronograph+7seg+1.jpg" width="640" /></a></div>
<br />
As usual feel free to ask questions and comment below.Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com71tag:blogger.com,1999:blog-4455987088008622536.post-84102525623262485372016-03-21T20:46:00.001+00:002016-03-21T22:57:55.411+00:00View Live data on your phone with Node-Red and Thingstud.ioSome time ago I came across a blog run by Pete Scargill (<a href="http://tech.scargill.net/">tech.scargill.net</a>) which dealt with many tech gadgets to do with IOT and home automation.<br />
<br />
There were a couple of subjects I found very interesting, Node Red and MQTT, these seemed to very useful tools to help develop home automation solutions.<br />
<br />
Node Red turned out to be pivotal in my ability to glue everything together, there are so many different nodes that can be used to link into different services.<br />
<br />
I'm running Node Red on my Raspberry Pi but it can also be installed on your PC and there is also a hosted installation of Node Red found <a href="https://fred.sensetecnic.com/" target="_blank">here</a> that allows to to try out an instance of node red without installing it on any platform at all, it runs in your browser and there is free account option.<br />
<br />
The FRED Node Red runs even when your PC is switched off, there are some limitations around hardware inputs that would normally come from your PC like serial data and data from your OS, also you cannot install any of your own nodes.<br />
<br />
Another important aspect of home automation was remote access to the data, whilst you are in your home on your own network this is not too difficult but when you are out and about and want to know what you hot water temperature is or if your central heating is on then it's a bit trickier, unless you expose your network to the outside world that is.<br />
<br />
This is where cloud hosted MQTT servers came in for me, they allow me to send and receive data to and from the outside world easily and securely (at least I hope it's secure).<br />
<br />
So to learn how to use the tools I set a goal to measure the hot water temperature in my storage tank and transmit an MQTT topic via WiFi and using Node Red to receive it and process it, if required before displaying it on my phone using Thingstud.io, the next step will be to have a button in the app to switch the hot water heating on/off manually and/or automatically switch it on from Node Red.<br />
<br />
<h4>
<b>Step1 - Measure the hot water temp and send via an MQTT topic</b></h4>
<div>
For this I used and ESP-12 mounted on a development board I bought from AliExpress</div>
<div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlO6FfPXY4mM3MS1o4DFhZtcsEhpHqdvF8XEswbXFSGG-pscneJMysLnBPrXwBz3hWuTsEvXUi4ueBw7hBj6hYmftGHKQrf5zUAj9VAPVeOGtV09ur8WnfeDsC5eW9ZFtwmQxcEwf7lKQ/s1600/NodeMCU.JPG" imageanchor="1"><img border="0" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlO6FfPXY4mM3MS1o4DFhZtcsEhpHqdvF8XEswbXFSGG-pscneJMysLnBPrXwBz3hWuTsEvXUi4ueBw7hBj6hYmftGHKQrf5zUAj9VAPVeOGtV09ur8WnfeDsC5eW9ZFtwmQxcEwf7lKQ/s320/NodeMCU.JPG" width="320" /></a></div>
<div>
There are also other boards that can be used</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvtjZtSIEiIdFvbPW32ipnTKD7bSxRDdwmnVVOgcCF99Yn_2nXX_QnaQXNOm4hA58Fhy9SeM4-qj5ybjy9ta8a0q1sl5d8P0tZ8EFuLMaWuvmdBFFZ5v7zF-aMbJgk6pk0zBmlTuyiT2s/s400/WeMos+D1+Mini.JPG" style="margin-left: auto; margin-right: auto;" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;">WeMos D1 Mini</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbLdcditiuJIym3Oi8bgKfH3f0soAJiDPAnvqVxnQIWwStBwaND-fpM5nR2I56-_6XxeHZ0zqP-MQIyDdPVS9YLy0mN5zCCqqIOEE3yf37yd5vkatqXUNf7M3nK3tdAEOg_0bOeCklkEM/s1600/Witty+cloud+ESP12.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="244" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbLdcditiuJIym3Oi8bgKfH3f0soAJiDPAnvqVxnQIWwStBwaND-fpM5nR2I56-_6XxeHZ0zqP-MQIyDdPVS9YLy0mN5zCCqqIOEE3yf37yd5vkatqXUNf7M3nK3tdAEOg_0bOeCklkEM/s320/Witty+cloud+ESP12.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Witty Cloud</td></tr>
</tbody></table>
The Fritzing circuit looks like this<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCUn-Yq5DTO1M0R73TKy-euJ8GcPIVBmKLc6otAd5lWmCTFMKezQoLk0LMn19Chd9KHdsB0YuDiDKJpOuUHt_lBN9dtKlT1x9ONr7LxtIQyswzzXP0d9kVWInzkWSWwhEXJIOoAJUeXDA/s1600/HotWaterCircuit.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="236" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCUn-Yq5DTO1M0R73TKy-euJ8GcPIVBmKLc6otAd5lWmCTFMKezQoLk0LMn19Chd9KHdsB0YuDiDKJpOuUHt_lBN9dtKlT1x9ONr7LxtIQyswzzXP0d9kVWInzkWSWwhEXJIOoAJUeXDA/s400/HotWaterCircuit.JPG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div>
In the Fritzing diagram above I've shown a battery for the supply but I actually use a 5V mains USB supply plugged into the USB connector and the DS18B20 Temperature sensor I used is the probe version so that the sensing part can be fed through the tank's insulation to touch the copper tank near to the top.</div>
<div>
<br /></div>
<div>
Before writing the sketch for the ESP-12 I tried out a couple of different MQTT providers: -</div>
<div>
<ul>
<li>Mosquitto installed on my raspberry Pi</li>
<li><a href="https://www.cloudmqtt.com/" target="_blank">CloudMQTT.com</a> private broker with password access.</li>
<li><a href="http://www.hivemq.com/" target="_blank">HIVEMQ</a> - free public access MQTT broker (no password)</li>
</ul>
</div>
<div>
I settled on Cloudmqtt using a free account but found that the app I created in Thingstud.io wouldn't work on my Android phone, I got in touch with the thingstud.io support and they were very helpful and said it worked on their Android phone and offered to help debug my phone to find out why but I didn't really want to spend the time trying to fix it so I tried the public server version of HIVEMQ and that worked great.</div>
<div>
<br /></div>
<div>
If you are new to MQTT then HIVEMQ have some really good introduction documents <a href="http://www.hivemq.com/docs/hivemq/latest/" target="_blank">here</a> that explain everything.<br />
<div>
<br />
Before using the Arduino IDE to program your ESP12 you will need to add the details to your boards manager, details can be found <a href="https://github.com/esp8266/Arduino" target="_blank">here</a>.</div>
<br />
Then you can program your ESP with this sketch, don't forget to edit the SSID and passwords sections in the code to suit your network and mqtt broker.<br />
<br />
This sketch uses the Cloudmqtt broker.</div>
<pre class="highlight language-javascript" id="flow" style="background: rgb(243, 231, 231); border-radius: 3px; border: 1px solid rgb(190, 154, 154); box-sizing: border-box; cursor: pointer; margin-bottom: 10px; margin-top: 10px; padding: 10px; word-wrap: break-word;"><span style="color: #553333;"><span style="font-size: 12px; line-height: 22px; white-space: pre-wrap;"><span style="font-size: 12px; line-height: 22px; white-space: pre-wrap;">
/*
Basic ESP8266 MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic" every two minutes
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
- If the first character of the topic "inTopic" is an 1, switch ON the ESP Led,
else switch it off
- Read the temperature of a single DS18B20 device and publish it to the MQTT broker
- Read the battery supply voltage and publish it to the MQTT broker
It will reconnect to the server if the connection is lost using a blocking
reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to
achieve the same result without blocking the main loop.
After publishing the data it will then go to sleep for nnn seconds (set nnn in the int interval)
For the ESP-12 to wake up after the nnn interval you will need to connect D0 to the reset pin
or if supplied from a mains adapter you can remove the sleep command altogether.
I have also commented out the code that switches on the LED.
To install the ESP8266 board, (using Arduino 1.6.4+):
- Add the following 3rd party board manager under "File > Preferences -> Additional Boards Manager URLs":
http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Open the "Tools > Board > Board Manager" and click install for the ESP8266"
- Select your ESP8266 in "Tools > Board"
*/
</span>
#include "esp8266wifi.h"
#include "onewire.h"
#include "dallastemperature.h"
#include "pubsubclient.h"
// Update these with values suitable for your network.
const char* ssid = "#######";
const char* password = "#######";
const char* mqtt_server = "m20.cloudmqtt.com";
const char* mqttUser = "#######";
const char* mqttPass = "#######";
float temp; //store temperature value
float BattLevel; //Store Battery voltage
int interval = 120;//Interval between messages in seconds
char msg[50];
ADC_MODE(ADC_VCC);//Set the ADCC to read supply voltage.
WiFiClient espClient;
PubSubClient client(espClient);
#define ONE_WIRE_BUS 2 // DS18B20 pin (D4)
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
void setup() {
Serial.begin(115200);
setup_wifi();
delay(5000);
client.setServer(mqtt_server, 10388);
client.setCallback(callback);
}
void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
Serial.print((char)payload[i]);
}
Serial.println();
// Switch on the LED if an 1 was received as first character
if ((char)payload[0] == '1') {
// digitalWrite(LED, LOW); // Turn the LED on (Note that LOW is the voltage level
// but actually the LED is on; this is because
// it is acive low on the ESP-01)
} else {
//digitalWrite(LED, HIGH); // Turn the LED off by making the voltage HIGH
}
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect("ESP8266Client",mqttUser, mqttPass)) {
Serial.println("connected");
// Once connected, publish an announcement...
client.publish("outTopic", "hello world");
// ... and resubscribe
client.subscribe("inTopic");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void loop() {
if (!client.connected()) {
reconnect();
}
client.loop();
//Read Temperature from DS18B20
DS18B20.requestTemperatures();
temp = DS18B20.getTempCByIndex(0);
//Read supply voltage
BattLevel= ESP.getVcc();
/*Print Temp and Battery level [optional]
Serial.print("Temperature: ");
Serial.println(temp);
Serial.print("Supply Voltage: ");
Serial.println(BattLevel);
delay(200);
*/
//Publish Data to MQTT
dtostrf(temp, 4, 2, msg); //Convert float to string
client.publish("Temperatures/HotWater/Temp", msg, true);
Serial.print("Published message Temp: ");
Serial.println(msg);
dtostrf(BattLevel, 3, 1, msg); //Convert float to string
client.publish("Temperatures/HotWater/Battery", msg, true);
Serial.print("Published message Batt Level: ");
Serial.println(msg);
//Disconnect from WiFi before sleep
client.disconnect();
WiFi.disconnect();
delay(100);
Serial.print("Entering deep sleep for ");
Serial.print(interval/60);
Serial.println(" Minutes");
ESP.deepSleep(interval * 1000000, WAKE_RF_DEFAULT);
//ESP.deepSleep(10 * 1000, WAKE_NO_RFCAL);
delay(500); // wait for deep sleep to happen
}</span></span></pre>
To test the sketch you can use the Websocket UI in the Control panel<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Hw8ATNQ9i1dk_89Oh2F7qSkaiSi1NM55s6f_RiCzinPyOxxcJ4L85CLmCfC86JyqO7gvHJQZ2NzhVELixMun2mZ0C8J6lpsQv15ok1OfpRJFZsIPfYn-BjcfejE7eNek5RvFneAKNzs/s1600/CloudMQTTConsole.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Hw8ATNQ9i1dk_89Oh2F7qSkaiSi1NM55s6f_RiCzinPyOxxcJ4L85CLmCfC86JyqO7gvHJQZ2NzhVELixMun2mZ0C8J6lpsQv15ok1OfpRJFZsIPfYn-BjcfejE7eNek5RvFneAKNzs/s640/CloudMQTTConsole.JPG" width="640" /></a></div>
In the next part I'll go through setting up Thingstud.io to display the data on your phone.Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-76978992678913781962016-03-18T17:04:00.000+00:002016-04-11T19:30:49.158+01:00Wireless BatteryOver the years I've made a few projects all centred around the Arduino, in its many forms and more recently I've started to use the very useful ESP8266 device, both of these are happy to run on 3.3V (ESP8266 should be 3.3V).<br />
<br />
As I use batteries to power the various project around the house and garden I've accumulated a number of different batteries, mainly Lithium Ion ones at 3.7V.<br />
I use some 18650 cells from an old laptop battery that comprise two cells wired in parallel and some mobile phone type batteries that are thin and light.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi06u9QqaJM0Db_R5PQ0PtgJnKaAGS4Rz55SenJmX4RgmHN1jQeLUKnm1uSS4xRShHYhg_iR_WZHQGzO-7PnDOqba1fqshAWYGUUeNRl4POVoqV31h2t2CFpn3iFHuGUmDvwPfKMx7O6z4/s1600/WirelessBattery5.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi06u9QqaJM0Db_R5PQ0PtgJnKaAGS4Rz55SenJmX4RgmHN1jQeLUKnm1uSS4xRShHYhg_iR_WZHQGzO-7PnDOqba1fqshAWYGUUeNRl4POVoqV31h2t2CFpn3iFHuGUmDvwPfKMx7O6z4/s320/WirelessBattery5.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Two 18650 cells in parallel housed in a 3D printed case</td></tr>
</tbody></table>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXEZ03cfZ_6QKxyACWBH23fR15ct-VwT3cyAh90kFAArIR_HkjRbykiDLOxu0VbjTTL3v0OLL68eQYSwfX1jKth1YzZSB6pTVbGedVXn3zLnY0hF2f8WZuz_BZbCWJIb2rjSlg-Sdv99A/s1600/Qi-Wireless-Galaxy-S4.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="299" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXEZ03cfZ_6QKxyACWBH23fR15ct-VwT3cyAh90kFAArIR_HkjRbykiDLOxu0VbjTTL3v0OLL68eQYSwfX1jKth1YzZSB6pTVbGedVXn3zLnY0hF2f8WZuz_BZbCWJIb2rjSlg-Sdv99A/s320/Qi-Wireless-Galaxy-S4.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Galaxy S4 QI Charge pad</td></tr>
</tbody></table>
I'm continually charging these batteries up and running them down and I had an idea the other day when I came across an old QI charge receiver I had used in a Samsung S4 to wirelessly charge the phone.<br />
<br />
I wondered if I could connect the output to a lithium Ion battery charger PCB, from China and stick the pad onto a battery, this would allow me to just place the battery on a QI pad to charge it up and even place the device using the battery on the pad to keep it powered/charging.<br />
<br />
<br />
<br />
<br />
<br />
<br />
It was quite simple to remove the USB socket from the PCB and solder to the charge pad and connect to the battery.<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpKxOJzMOf_C7TESX9O5mlr-4L1T9aueZ9M9priP54bN6CyfXxuhH5ZKpz55kjEFeYTBgG1qT_VvcoqonpNwDPRf05SN62PcaOWn7kZFuWajZi7V_STH82pxYlKwrEwgTubDzxXzLsyi8/s1600/2016-03-17+15.34.02.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpKxOJzMOf_C7TESX9O5mlr-4L1T9aueZ9M9priP54bN6CyfXxuhH5ZKpz55kjEFeYTBgG1qT_VvcoqonpNwDPRf05SN62PcaOWn7kZFuWajZi7V_STH82pxYlKwrEwgTubDzxXzLsyi8/s320/2016-03-17+15.34.02.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The battery, charge pad connected to the charger PCB</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLptc_jPJ-9L_Snu54cUOb2zJedoomfhmn2pWH18bSAhqHMBZOEOqemnzkMRB-UVxpqixv598rVV09-QKInuI42dlqv9lmQHUDGeRXPUfMk7rKBQLPahznCemT-nMO7uVF2pCnoVXTzt4/s1600/WirelessBattery2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLptc_jPJ-9L_Snu54cUOb2zJedoomfhmn2pWH18bSAhqHMBZOEOqemnzkMRB-UVxpqixv598rVV09-QKInuI42dlqv9lmQHUDGeRXPUfMk7rKBQLPahznCemT-nMO7uVF2pCnoVXTzt4/s320/WirelessBattery2.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The QI pad folded around the battery</td></tr>
</tbody></table>
<br />
<div>
After that I used some heat shrink tubing used for battery packs to hold it all together.</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ_rFRoQRd8KBNRNnaVGFMxzmg9irSpEWWN9Nbw1J01hjbRMu3dFa7DzdLMeTxmAWwgtngtA4-JU3gbZKPmas4Ecy8rXnkxboIcXHVcjMWoPkpwpwfuV0KyygA3D36RlQH11AOjwZA35k/s1600/WirelessBattery3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ_rFRoQRd8KBNRNnaVGFMxzmg9irSpEWWN9Nbw1J01hjbRMu3dFa7DzdLMeTxmAWwgtngtA4-JU3gbZKPmas4Ecy8rXnkxboIcXHVcjMWoPkpwpwfuV0KyygA3D36RlQH11AOjwZA35k/s320/WirelessBattery3.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Whole assembly going into the shrink tubing</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
The final package can then be used to power the project.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjELHBCXzTTu9TYyX0yektWIddGclFPE0YdcJFE4pJRHidzx_jq_FQeHRavbb6LydIeRoTllMGCizWOXIzHsrfEJuWAZTHnOS_QzPB_t5TkH7NaGjJDLCDapiLGpiND7CC7C9UxvMD5Lh4/s1600/WirelessBattery4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjELHBCXzTTu9TYyX0yektWIddGclFPE0YdcJFE4pJRHidzx_jq_FQeHRavbb6LydIeRoTllMGCizWOXIzHsrfEJuWAZTHnOS_QzPB_t5TkH7NaGjJDLCDapiLGpiND7CC7C9UxvMD5Lh4/s320/WirelessBattery4.png" width="320" /></a></div>
<div>
<br />
The next step is to 3D print a new case for the two 16850 cells to include the charge pad and PCB and look at using a 5V supercap and charge pad to power my temperature monitor project.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGEaK9Q_9TmKI5A5NXcb4TrSOlkolvNVcUUhA2w0onJIkDoiiJYpB8HTz3mT1w2nvXna2pMe-Q5u9DJr4qllmmeIR5W42d0M_lezT-tpqX0k9PElpc6pkTyPclgzyxnZ9E7-Lx544U9gU/s1600/RemoteTempDisplay.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGEaK9Q_9TmKI5A5NXcb4TrSOlkolvNVcUUhA2w0onJIkDoiiJYpB8HTz3mT1w2nvXna2pMe-Q5u9DJr4qllmmeIR5W42d0M_lezT-tpqX0k9PElpc6pkTyPclgzyxnZ9E7-Lx544U9gU/s320/RemoteTempDisplay.png" width="320" /></a></div>
<br /></div>
Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-15508789806549846192016-01-28T23:16:00.001+00:002016-01-28T23:16:20.400+00:003D printed bezel for the Nextion LCD displayPrompted by a post on another blog I read I dug out the 2.4" Nextion LCD display and thought I'd give it another go and whilst looking around the Nextion website I found that they'd designed some 3D bezels for the different size displays they do.<br />
Well, as I got a 3D printer at Christmas I thought I would print one out for my display.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGO0-xR7wCDGrs0S3F52x2vQyGVXqcYTCAYyzDqxxIN_-Uym6kxW6cr5LmaBjKcycd06rdraCI2lFIdMDez_gSasKiTOoam6o5fxelLsxPuonnAJhX1VaKh1G77jpqKcTIPN3iIDgSdCk/s1600/Nextion_3D_Bezel_Print_front.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGO0-xR7wCDGrs0S3F52x2vQyGVXqcYTCAYyzDqxxIN_-Uym6kxW6cr5LmaBjKcycd06rdraCI2lFIdMDez_gSasKiTOoam6o5fxelLsxPuonnAJhX1VaKh1G77jpqKcTIPN3iIDgSdCk/s400/Nextion_3D_Bezel_Print_front.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2kczU6LU8BEe3YzZkrazr8CoElfwkq3qj-v7m9Zp-jupsKy-eGLookRccso9us2eZVNu8-F5F1GAoebwWhS213KNEdRK-DmQUXBZAp766a3rIgKOfGAVEJ2ug60yjrSwTKXBfZqguiwk/s1600/Nextion_3D_Bezel_Print_back.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2kczU6LU8BEe3YzZkrazr8CoElfwkq3qj-v7m9Zp-jupsKy-eGLookRccso9us2eZVNu8-F5F1GAoebwWhS213KNEdRK-DmQUXBZAp766a3rIgKOfGAVEJ2ug60yjrSwTKXBfZqguiwk/s400/Nextion_3D_Bezel_Print_back.JPG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The result wasn't too bad. I think the bezel had been designed with some fancy curves on the front edges and because I printed it face down they had quite pronounced bits of filament that had to be removed, I think I will modify the bezel in Tinkercad to make the face flat.</div>
<div class="separator" style="clear: both; text-align: left;">
I tried to sand the face a little smoother but the PLA became slightly discoloured from the glasspaper I used.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The rear was quite good with some strengthening ribs included and I found some small screws that made a tight fit and held in the display.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Next step is to make a backing box for the bezel to fit into but I'm waiting until I finalise the design of the project so I know what depth I need in the case.</div>
<div class="separator" style="clear: both; text-align: left;">
I got a quote from Shapeways 3D printing service to print this design and it was £7.65 plus postage, although the quality would be better than from my printer I'm quite happy with the quality and I suppose I could also paint it to get a better finish, I'd better google "painting PLA".</div>
Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com3tag:blogger.com,1999:blog-4455987088008622536.post-60155854814827913852016-01-11T13:43:00.000+00:002016-01-14T20:09:35.953+00:003D Printer Pushbullet NotificationI recently bought a 3D printer XYZ Dzvinci Jr.), mainly because it was £100 off at Ebuyer, and I've been printing loads of stuff from <a href="http://www.thingiverse.com/" target="_blank">Thingiverse</a> and designing some of my own stuff using <a href="http://www.tinkercad.com/">www.tinkercad.com</a>.<br />
<br />
One of the things you soon notice is how long it takes to print a design, it can take hours for a large design and as the printer is upstairs and I was constantly going up and down stairs seeing if it had finished yet.<br />
<br />
So I thought I'd use some electronics to send a notification when it had finished. I decided to use an ESP8266 to connect to my network and send a Pushbullet notification which I will receive on my phone and also my PC, through a Chrome add-on.<br />
<br />
I noticed that after the printer had finished the table moved right to the front of the printer and I thought to use a micro-switch that would be triggered by the table when it moved to the front.<br />
As luck would have it I had the perfect switch in my box of bits and I was able to mount it using two screws and two Tee-Nuts into the existing aluminium profile frame of the printer.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJK4plPxLSry_cFTfv77Y-zpZ9e2k14jNqSLa6bdLgd4kLkwE2rSdHfFyiedWWgiUdruffQFNTT9k_jlIpezfqkZZUD3eN8rtwUQ7baGJe7zIT9kTp0x3hkD__5o4mai2j4WvVyLpVPDg/s1600/3D+printer+pushbullet+notifier+1.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJK4plPxLSry_cFTfv77Y-zpZ9e2k14jNqSLa6bdLgd4kLkwE2rSdHfFyiedWWgiUdruffQFNTT9k_jlIpezfqkZZUD3eN8rtwUQ7baGJe7zIT9kTp0x3hkD__5o4mai2j4WvVyLpVPDg/s400/3D+printer+pushbullet+notifier+1.jpg" width="307" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Test setup running off batteries through the micro-switch</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
I found an Arduino sketch that sends a Pushbullet notification on the <a href="http://www.esp8266.com/viewtopic.php?f=29&t=7116" target="_blank">ESP8266.com</a> forum, this sketch makes an HTTPS connection to Pushbullet and sends a text note, the code is all in the setup section of the sketch and only runs once, this was actually just what I wanted as I was going to use the micro-switch to power up the ESP8266 rather that use it as a button input.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The hardware I used was a development ESP board from <a href="http://www.aliexpress.com/item/ESP8266-serial-WIFI-Witty-cloud-Development-Board-ESP-12F-module-MINI-nodemcu/32566502491.html" target="_blank">ALiExpress</a> they are less than $3 each and come in two parts, one being the USB/serial interface and the other the actual ESP board.</div>
<div class="separator" style="clear: both; text-align: left;">
I use the RGB LED on the board to show the progress of the connection</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul>
<li>Red = Waiting to connect to your WiFi router.</li>
<li>Green indicates a successful connection.</li>
<li>Blue LED to show the Pushbullet notification was sent.</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: left;">
You can probably use this sketch with any of the ESP8266 variants and if you don't want the status LED then you could use a bare ESP-12 or even an ESP-01.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
After the notification is sent I've tried to put the ESP to sleep to reduce the drain on the batteries but I'm getting some funny results so far, the current does reduce significantly but not as much as I would expect, more work required...</div>
<div class="separator" style="clear: both; text-align: left;">
I expect to be home when a print finishes so the battery drain isn't too much of an issue and I think I'll look at taking power from the printer itself once I make the install more permanent.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I also thought that this could be used for all sorts of things like security monitoring etc. the message could be triggered from an input connected to a magnetic switch or a PIR possibly or connected into an existing security system to give you a notification on your mobile when triggered if I can get the power usage down it would make a good portable warning system. Although I used Pushbullet because it's a convenient way to get in and out of your home network without exposing it, you could use other cloud solutions or just use it internally with Node-Red on a Raspberry Pi ?? </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Sketch</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<pre class="highlight language-javascript" id="flow" style="background: rgb(243, 231, 231); border-radius: 3px; border: 1px solid rgb(190, 154, 154); box-sizing: border-box; color: #553333; cursor: pointer; font-size: 12px; line-height: 22px; margin-bottom: 30px; margin-top: 30px; padding: 30px; white-space: pre-wrap; word-wrap: break-word;">
#include esp8266wifi.h
#include wificlientsecure.h
/*
This Sketch posts a text message to you phone via Pushbullet indicating that my 3D Printer
has finished printing, the message is triggered whenever the ESP8266 is powered up.
The code runs in the setup not the loop so it will only run the once.
The source for this code was found on www.esp8266.com forum under example sketches and was
posted by DedeHai.
The code uses an RGB LED on three outputs to indicate the status of the message:
RED = Not connected to the WiFi
Green = Connected to router
Blue = Pushbullet note sent.
*/
const char* ssid = "*******"; //Your WiFi SSID
const char* password = "**********"; //Your WiFi password
const char* host = "api.pushbullet.com";
const int httpsPort = 443;
const char* PushBulletAPIKEY = "****************************"; //get it from your pushbullet account
const int REDLED = 15; //LED Pins
const int GREENLED = 12;
const int BLUELED = 13;
long t = 0; // timer count
// Use web browser to view and copy
// SHA1 fingerprint of the certificate
const char* fingerprint = "2C BC 06 10 0A E0 6E B0 9E 60 E5 96 BA 72 C5 63 93 23 54 B3"; //got it using https://www.grc.com/fingerprints.htm
WiFiClientSecure client;
void setup() {
pinMode(GREENLED, OUTPUT);
pinMode(BLUELED, OUTPUT);
pinMode(REDLED, OUTPUT);
analogWrite(REDLED, 100);//No wifi connection
analogWrite(GREENLED, 0);//No wifi connection
analogWrite(BLUELED, 0);//No wifi connection
Serial.begin(115200);
Serial.println();
Serial.print("connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
analogWrite(REDLED, 0);// wifi connection
analogWrite(GREENLED, 50);//wifi connection
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// Use WiFiClientSecure class to create TLS connection
Serial.print("connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("connection failed");
return;
}
if (client.verify(fingerprint, host)) {
Serial.println("certificate matches");
} else {
Serial.println("certificate doesn't match");
}
String url = "/v2/pushes";
String messagebody = "{\"type\": \"note\", \"title\": \"3D Printer\", \"body\": \"3D Print Finished\"}\r\n";
Serial.print("requesting URL: ");
Serial.println(url);
client.print(String("POST ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Authorization: Bearer " + PushBulletAPIKEY + "\r\n" +
"Content-Type: application/json\r\n" +
"Content-Length: " +
String(messagebody.length()) + "\r\n\r\n");
client.print(messagebody);
Serial.println("request sent");
//print the response
while (client.available() == 0);
while (client.available()) {
String line = client.readStringUntil('\n');
Serial.println(line);
analogWrite(GREENLED, 0);//Message answer recieved
analogWrite(BLUELED, 100);//Message answer recieved
t = millis();
while (millis() <= t + 1000);
yield();
analogWrite(BLUELED, 0);//Message answer recieved
}
ESP.deepSleep(60000000);
}
void loop() {
}</pre>
More on the 3D printer later...Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com5tag:blogger.com,1999:blog-4455987088008622536.post-73254129465863222572015-05-26T20:47:00.000+01:002015-05-26T20:47:33.060+01:00Node-Red Raspberry Pi LED control via PushbulletI've been using Node-Red for a few days now and can't believe how powerful it is and although it has its moments it's not too difficult to use.<br />
I've been searching the extra nodes and flows (a collection of nodes and functions added together to perform an action) that can be found here <a href="http://flows.nodered.org/" target="_blank">http://flows.nodered.org/</a> and found quite a few really useful contributions.<br />
<br />
I decided to publish a simple flow that I created to switch on/off an LED connected to Pin11 of my RPi using my phone and Pushbullet.<br />
<br />
Pushbullet is an app for Android, PCs (Chrome) and Iphones to broadcast information between your devices, for example I can get the notifications that appear on my Android phone to pop-up on my PC when I'm using the Google Chrome plugin.<br />
<br />
What this flow does is when I send a push note from my phone containing the words "LED on" the push server sends it to my devices including the node on the RPi server the flow then sends a 1 to the output pin of the RPi switching the LED on and then sends a push note back to the phone with a confirmation "LED is on". Sending "LED off" switches the LED off.<br />
<br />
All this without having to know any Python at all..... brilliant!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFTAQmW3iJBuxgZOj_H9jKvgsuWKMBWW7Vm-avEEenz6TA3boEYCSbRQ3lgGDuG5MGdTl6dgM3YK_nG2r5E42_8J6Hf_kvesW-_X7zQzt9oYhj4Iu7cRRot4J8iV9Gc-4z_2-IBGIcLXM/s1600/RPi_LED_on_off_Flow.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFTAQmW3iJBuxgZOj_H9jKvgsuWKMBWW7Vm-avEEenz6TA3boEYCSbRQ3lgGDuG5MGdTl6dgM3YK_nG2r5E42_8J6Hf_kvesW-_X7zQzt9oYhj4Iu7cRRot4J8iV9Gc-4z_2-IBGIcLXM/s640/RPi_LED_on_off_Flow.JPG" width="640" /></a></div>
<br />
The flow is available on GitHub Gist <a href="https://gist.github.com/gadjet/6a461d17f0a7b9d7bfd7" target="_blank">here</a> or you can just copy the text below and paste it into the import from clipboard in node-red.<br />
<pre class="highlight language-javascript" id="flow" style="background: rgb(243, 231, 231); border-radius: 3px; border: 1px solid rgb(190, 154, 154); box-sizing: border-box; color: #553333; cursor: pointer; font-size: 12px; line-height: 22px; margin-bottom: 30px; margin-top: 30px; padding: 30px; white-space: pre-wrap; word-wrap: break-word;">[{"id":"8cc62775.7339d8","type":"pushbullet-config","name":"Phil Grant"},{"id":"36bc98c5.c94368","type":"inject","name":"LED on","topic":"","payload":"LED on","payloadType":"string","repeat":"","crontab":"","once":false,"x":507,"y":450,"z":"6a77b09e.95885","wires":[["2b89fef6.d47602"]]},{"id":"2b89fef6.d47602","type":"switch","name":"LED Control","property":"payload","rules":[{"t":"eq","v":"LED on"},{"t":"eq","v":"LED off"}],"checkall":"true","outputs":2,"x":655,"y":504,"z":"6a77b09e.95885","wires":[["89d6dac1.762928","dba96b7a.245698"],["f6e1a3b9.091e6","cd9a199b.3265e8"]]},{"id":"dd181fd3.22e7e","type":"pushbullet in","config":"8cc62775.7339d8","name":"Push input","x":488,"y":505,"z":"6a77b09e.95885","wires":[["2b89fef6.d47602"]]},{"id":"89d6dac1.762928","type":"template","name":"On","field":"payload","format":"handlebars","template":"1","x":856,"y":487,"z":"6a77b09e.95885","wires":[["69f3331c.960ccc"]]},{"id":"dba96b7a.245698","type":"template","name":"LED is On","field":"payload","format":"handlebars","template":"LED is On","x":865,"y":453,"z":"6a77b09e.95885","wires":[["e69cd2aa.19633"]]},{"id":"f6e1a3b9.091e6","type":"template","name":"off","field":"payload","format":"handlebars","template":"0","x":855,"y":531,"z":"6a77b09e.95885","wires":[["69f3331c.960ccc"]]},{"id":"cd9a199b.3265e8","type":"template","name":"LED is Off","field":"payload","format":"handlebars","template":"LED is off","x":865,"y":564,"z":"6a77b09e.95885","wires":[["c099b247.3f665"]]},{"id":"1d5efe9b.e2a101","type":"inject","name":"LED Off","topic":"","payload":"LED off","payloadType":"string","repeat":"","crontab":"","once":false,"x":501,"y":568,"z":"6a77b09e.95885","wires":[["2b89fef6.d47602"]]},{"id":"69f3331c.960ccc","type":"rpi-gpio out","name":"Pin 11","pin":"11","set":true,"level":"0","out":"out","x":1024,"y":507,"z":"6a77b09e.95885","wires":[]},{"id":"e69cd2aa.19633","type":"pushbullet","config":"8cc62775.7339d8","pushtype":"note","title":"LED Status","chan":"","name":"LED is On","x":1032,"y":453,"z":"6a77b09e.95885","wires":[]},{"id":"c099b247.3f665","type":"pushbullet","config":"8cc62775.7339d8","pushtype":"note","title":"LED Status","chan":"","name":"LED is Off","x":1031,"y":564,"z":"6a77b09e.95885","wires":[]}]</pre>
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-71348379356092698902015-05-24T12:20:00.000+01:002015-05-24T12:20:40.047+01:00Shortcut Keyboard - ExtendedJust a quick update to my shortcut keyboard.<br />
I really started to use this while at work and found it really useful but there weren't enough buttons so I had an idea to double the size by getting some new acrylic fronts and backs made that were double the width and held two PCBs next to each other.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5QgV1iVFkOYWaHVrSdc5Rea0yQ270ytnTRGeJOza_UUsPD-75J-vsmi1UOKxuUPSs5Wj5alKZro_QdBTIJbkTCcCKGXoJjyR3zFF6VpGjlrq6Gyvy8hpUphOij_Tno8xmBfk4Ne7qjuY/s1600/2015-05-17+17.35.00.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5QgV1iVFkOYWaHVrSdc5Rea0yQ270ytnTRGeJOza_UUsPD-75J-vsmi1UOKxuUPSs5Wj5alKZro_QdBTIJbkTCcCKGXoJjyR3zFF6VpGjlrq6Gyvy8hpUphOij_Tno8xmBfk4Ne7qjuY/s640/2015-05-17+17.35.00.jpg" width="640" /></a></div>
<br />
There are enough inputs left on the Arduino to connect the second set of buttons so no need for another Arduino.<br />
<br />
I use Sketchup a lot and now I can attach several commands to the second set of buttons.Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-46238615556576850692015-05-12T20:42:00.000+01:002015-05-12T20:42:55.407+01:00Discovering Node-red Part 1Trawling around the various Arduino interest sites and blogs I quite often discover some new and very interesting information on some new topics and some not so new but un-known to me.<br />
<br />
Sometime ago I'd read about a visual interface called Node-Red for designing IoT information flows and I was interested but didn't have the time to investigate so it was put on the back burner.<br />
<br />
I then found out about the very versatile ESP-8266 that is a very inexpensive WiFi adapter for Arduino that comes in several flavours and can host a web page.<br />
<br />
Anyway whilst I was searching around for info on the ESP8266 I found an excellent blog by Peter Scargill (<a href="http://tech.scargill.net/" target="_blank">here</a>) and on his blog he'd written some posts about a couple of very interesting topics, <a href="http://nodered.org/" target="_blank">node-red </a>and <a href="http://www.grovestreams.com/" target="_blank">Grovestreams</a>. In this post I'll try to give you a helping hand by describing my efforts to get it all up and running.<br />
<br />
<span style="font-size: large;">Objective</span><br />
My goal was to have the RPi receiving temperature data from an external <a href="http://www.digitalsmarties.net/products/jeenode" target="_blank">Jeenode</a> via 868MHz (EU) using a <a href="http://www.digitalsmarties.net/products/jeelink" target="_blank">Jeelink</a> plugged into the RPi USB port, this would then be sent to Grovestreams to graph and also have twitter and/or email alerts setup dependent on temp. values. Please remember though that I'm a beginner at this not an expert so there might be better ways to achieve this....<br />
<br />
<span style="font-size: large;">First - node-red</span><br />
This software appears to be a visual interface that utilises Node.js which is a platform built on Chrome's JavaScript runtime. There is an explanation on the node-red web page on installing both node.js and node-red for PCs and the Raspberry Pi.<br />
<br />
<b>Step one - installation</b><br />
I decided to install node-red on My Windows7 PC first and if I could get it working I would brush the dust of my RPi and fire it up, I installed Node.js following the instructions <a href="http://nodered.org/docs/getting-started/installation.html" target="_blank">here</a> and then installed node-red, I think the installation is a little tricky unless you're confident using the command window in Windows but follow the instructions and you should be OK.<br />
<br />
<b>Step two - Run node-red</b><br />
Node-red is run from a cmd window, I ran it using "run as administrator" from the right click context menu, when you run it it starts a server on your PC at http://localhost:1880 and this brings up the visual editor for creating your flows.<br />
This is what my flow eventually looked like, I have added some descriptive text after the screen-grab was taken.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr4Cb4qR3T1dDxxsGoAixHa36txJlP585UToOXh03MLwzqHc9wni6PgHACPnKGKM_GRQ74q66FCDz3d6rOnI-cB2zFC-3npUFD21y0mE5L9bR3RVjLvYxoCgyicsNpyt_5V558fUCqK9w/s1600/Node-red-RPi.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr4Cb4qR3T1dDxxsGoAixHa36txJlP585UToOXh03MLwzqHc9wni6PgHACPnKGKM_GRQ74q66FCDz3d6rOnI-cB2zFC-3npUFD21y0mE5L9bR3RVjLvYxoCgyicsNpyt_5V558fUCqK9w/s400/Node-red-RPi.JPG" width="400" /></a></div>
<br />
The layout shows all the different nodes down the left hand side, the editing window (where the nodes are dragged to) in the middle, the node information and debug output are on the right hand side (not shown).<br />
<br />
Each node has a set of properties relevant to its purpose, i.e. if you double click the serial port node you will be able to configure the port details.<br />
<br />
These grabs are from the RPi installation, the serial port names on PC install will look slightly different.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglhAFJtdfqJs598SN_K4SM7U0nz1OCeZVTYbvMIOXB7k2Ljl9TBz_Dpse_EPShf4PmXp36kQ3ntw_S9lcL6N5McB63keHUcwK0HnmRNjk6jpCdSA37wxkAOE6_MN4vreQz0q-NxkMvdCw/s1600/node-red+serial+config1.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglhAFJtdfqJs598SN_K4SM7U0nz1OCeZVTYbvMIOXB7k2Ljl9TBz_Dpse_EPShf4PmXp36kQ3ntw_S9lcL6N5McB63keHUcwK0HnmRNjk6jpCdSA37wxkAOE6_MN4vreQz0q-NxkMvdCw/s400/node-red+serial+config1.JPG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">First dialog after double clicking</td></tr>
</tbody></table>
Click the pencil icon to get the config dialog.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkAkwcL6nTpipwtK35xeeteDk947_NEiLPH2_nBPnhzhyFdxdrnTTS_HZlBq3slP2SEpVHbiPWrgtZKqn2HeM1ec4cRMOMKz3wtvPhU_ZEmQYfhjO3_Z3tVzCGoDg7yaKZdHm6bTXlMbc/s1600/node-red+serial+config2.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkAkwcL6nTpipwtK35xeeteDk947_NEiLPH2_nBPnhzhyFdxdrnTTS_HZlBq3slP2SEpVHbiPWrgtZKqn2HeM1ec4cRMOMKz3wtvPhU_ZEmQYfhjO3_Z3tVzCGoDg7yaKZdHm6bTXlMbc/s400/node-red+serial+config2.JPG" width="370" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Full serial port config dialog</td></tr>
</tbody></table>
<div>
The next node is called a switch node which can direct data to different outputs based on the incoming data, I realised later that I didn't need two nodes as one node can be given two outputs by adding a second rule.</div>
<div>
The message from the transmitter contains labels for the temp. values, Greenhouse and Outside, this switch node uses these labels to direct the temp. values towards the matching Grovestream node.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibbQRy2RjDEoqTIJH-ug0nYGxdgZJQUAqWW82NZ1KSgqi-_DItoXeWpFPYZZY5-tnLSL89gv3tv8vWxy75XzcICOgyK307vbYwVgK8iGtlbife9TN6hrQf_ZncPKGCDb9-9rALB47flE4/s1600/node-red+switch+1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="140" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibbQRy2RjDEoqTIJH-ug0nYGxdgZJQUAqWW82NZ1KSgqi-_DItoXeWpFPYZZY5-tnLSL89gv3tv8vWxy75XzcICOgyK307vbYwVgK8iGtlbife9TN6hrQf_ZncPKGCDb9-9rALB47flE4/s640/node-red+switch+1.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Double clicking on the switch node opens the config dialog and each time you click on the +rule button, bottom left, you will add another decision and output branch.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ZoMRoY21eH0OwkezgABRmr6a5RgdWE_VVEEbbOfReurOSsdRqFYT_ZujCm5yeQaDTqYUizOEGTTVDIXHdC_XjzvAX2WMk99CrTvwg_syuDW84VLT97Zb2y8GkrFM32EKfaPbglasP0w/s1600/node-red+switch+2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="362" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ZoMRoY21eH0OwkezgABRmr6a5RgdWE_VVEEbbOfReurOSsdRqFYT_ZujCm5yeQaDTqYUizOEGTTVDIXHdC_XjzvAX2WMk99CrTvwg_syuDW84VLT97Zb2y8GkrFM32EKfaPbglasP0w/s400/node-red+switch+2.JPG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
The message payload is directed to the relevant output but it still contains the label and I want to remove the label so the next "function" node removes the label leaving just the temp. value.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistvm_9mCRC8ZPtgY5vnZ1ROVmdJEjts09waOrJFp9PP_lrRr8LY1SHyAEZW7yrQisaI3z3fXJ4mLDaNHvgquKUl9egynyxUNVUygJSnrSjWyD5QAZpZpAaDdaOCkGAxRYAwEA6TxZ6M4/s1600/node-red+Function+node+1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEistvm_9mCRC8ZPtgY5vnZ1ROVmdJEjts09waOrJFp9PP_lrRr8LY1SHyAEZW7yrQisaI3z3fXJ4mLDaNHvgquKUl9egynyxUNVUygJSnrSjWyD5QAZpZpAaDdaOCkGAxRYAwEA6TxZ6M4/s400/node-red+Function+node+1.JPG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
I must admit that this function node took me a while to configure correctly, I can handle a few different programming languages but Javascript is not my favourite, the function basically splits the payload into parts around the ':' these 2 parts are referenced as 0 and 1 in an array and the second part [1] is passed on from the function thus removing the text label.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<b>The input is <span style="color: blue;">Greenhouse Temp:20.1</span> and the output is <span style="color: blue;">20.1</span></b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Once the value has been cleaned up it's ready to send off to my Grovesteams account, the Grove node has been written by Peter Scargill and the instructions to install it on Linux/RPi can be found <a href="https://bitbucket.org/scargill/grove/src" target="_blank">here</a>, for windows I downloaded the source files and placed them in a folder called "grove" in the following location: </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKCKFjiH2ZHL30dQB2lLlqRgxEHLBMqXvjZxO3OEgCyQjVD0x5AXukvLx0PP3XTJs6ttGjoi1nLXKVBm5G4FVyOsNO9GTX60UJlYTpWTF_OwDfaQrNKdUEd4XUBkxFceQ3x-F6YT0iPS0/s1600/Windows+GS+node+path.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="36" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKCKFjiH2ZHL30dQB2lLlqRgxEHLBMqXvjZxO3OEgCyQjVD0x5AXukvLx0PP3XTJs6ttGjoi1nLXKVBm5G4FVyOsNO9GTX60UJlYTpWTF_OwDfaQrNKdUEd4XUBkxFceQ3x-F6YT0iPS0/s640/Windows+GS+node+path.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
If installed correctly the purple node will appear in the list of nodes on the left hand side and is configured by double clicking. Peter has a good "how to" guide on his blog <a href="http://tech.scargill.net/using-grovestreams/" target="_blank">here</a>.</div>
<div style="text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVr6MZmcMMtJRQpijCYQj2zRLnvKD6qnBitXYtWEx3WjWHzHP_iFBIukVKZd9geHWyi2kdI6PEoAHWyYZSj4RW3m0FqLtTVFZlSzqrm1SJ3aHx3tGK_c8JnLidIoG-9OhdLLbZVYs3O1E/s1600/node-red+Grove+node.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVr6MZmcMMtJRQpijCYQj2zRLnvKD6qnBitXYtWEx3WjWHzHP_iFBIukVKZd9geHWyi2kdI6PEoAHWyYZSj4RW3m0FqLtTVFZlSzqrm1SJ3aHx3tGK_c8JnLidIoG-9OhdLLbZVYs3O1E/s400/node-red+Grove+node.JPG" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<b>End of part one.</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<br /></div>
Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-46654235655694306102015-04-09T19:23:00.001+01:002015-04-09T19:26:59.177+01:00Finished Shortcut KeyboardThe Acrylic tops and bottoms arrived yesterday for the keyboard so I thought I'd update the blog with a picture of the finished item side by side with the concept design,<br />
I must say I'm quite pleased with it, the holes actually line up with the buttons :-).<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV1LNTwfI3H-WtNmtRvQSS4Sjugjkp9oQLjZtrmdF2p7NniFYP_aurEJ5Pmrty2dO7Y-y2Ci9ZiLMDnlodME1QkUf9MbdQ92WPTyyavq6ijRulUnLjuFgpJ21PUu6w5MQPjqbF-pRX6eg/s1600/CopyPaste_Actual.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV1LNTwfI3H-WtNmtRvQSS4Sjugjkp9oQLjZtrmdF2p7NniFYP_aurEJ5Pmrty2dO7Y-y2Ci9ZiLMDnlodME1QkUf9MbdQ92WPTyyavq6ijRulUnLjuFgpJ21PUu6w5MQPjqbF-pRX6eg/s1600/CopyPaste_Actual.jpg" height="246" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Finished article</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwzR5miH073ukclmQAX3kzLEx_NQHLHwkGjrQifh97p9a5GsxgIBSfHzzTZxVpS5vbYDNpCX10kMi3Ijn5nJskixVReCbaYa41uNGKJYsXDx1Xx688FJ1bXgcJgutRzeaCPygadfyijfk/s1600/CopyPaste_proposal.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwzR5miH073ukclmQAX3kzLEx_NQHLHwkGjrQifh97p9a5GsxgIBSfHzzTZxVpS5vbYDNpCX10kMi3Ijn5nJskixVReCbaYa41uNGKJYsXDx1Xx688FJ1bXgcJgutRzeaCPygadfyijfk/s1600/CopyPaste_proposal.JPG" height="243" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">3D concept design</td></tr>
</tbody></table>
<br />
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-82810796158057460222015-03-14T20:49:00.001+00:002015-03-14T20:53:29.467+00:00Time saving Keyboard shortcuts for the PC<div class="separator" style="clear: both; text-align: center;">
</div>
It's been quite a while since my last post but sometimes life throws you a curved ball and changes your focus for a time. Anyway this little project came about due to a friend at work having to replace his PC keyboard but not being able to find one with single pre-programmed buttons for copy and paste, as did his current one, and I said " I can do that with an Arduino".<br />
<br />
So the idea was to use an Arduino Leonardo clone that can emulate a mouse or keyboard and then program the keyboard sequences to be triggered from the press of a button. Initially I was going to do just the copy, cut and paste but as I was going to use the standard 5cm x 5cm Seeedstudio PCB service I thought I could add some more buttons.<br />
<br />
I decided to do a PCB with six momentary push buttons, mainly because they were what I had in my box of components.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5l_GKgj_GZIILc4bB54md0rrHzXIh1_CXvGopCosZvyNacGLPQWI0xzD2arJc48zr_cDLZDW8rFojIIoINi8OOOwFoClcZxeLLN8ugHY2XGo_wYRxPiWj6pLojxrREoFq7smOU2LifdA/s1600/CopyPaste_2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5l_GKgj_GZIILc4bB54md0rrHzXIh1_CXvGopCosZvyNacGLPQWI0xzD2arJc48zr_cDLZDW8rFojIIoINi8OOOwFoClcZxeLLN8ugHY2XGo_wYRxPiWj6pLojxrREoFq7smOU2LifdA/s1600/CopyPaste_2.jpg" height="240" width="320" /></a></div>
<br />
The botom row, blue, black and white buttons are copy, cut and paste respectively and I assigned the red, amber and green buttons to change the background colour of Excel cells to match the button colour (this was a request from another friend at work who uses Excel a lot)<br />
<br />
The buttons could have any combination of key-presses assigned to them I suppose, 'Ctrl+Z' for undo etc.<br />
<br />
<h2>
<b>Circuit Diagram</b></h2>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJg2Dac4f2o9Ns0MEIUPM1FX9PDxMPATmWDi2kiJafCEL3SpZY__6ktApsorisyOZrqZzXD4X_8iO_G9PsuJqyDqCuoGzFYVUjTsuXOwBcHT-X5Skd9RH2tS4XjrXNf_s8AN3ElmHIW4Q/s1600/CopyPaste_SCH.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJg2Dac4f2o9Ns0MEIUPM1FX9PDxMPATmWDi2kiJafCEL3SpZY__6ktApsorisyOZrqZzXD4X_8iO_G9PsuJqyDqCuoGzFYVUjTsuXOwBcHT-X5Skd9RH2tS4XjrXNf_s8AN3ElmHIW4Q/s1600/CopyPaste_SCH.jpg" height="484" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The connections are a bit out of order due to pinswaps on the PCB!</td></tr>
</tbody></table>
<br />
I used the "Sick of Beige" 50mm x 50mm PCB template from <a href="http://www.seeedstudio.com/" target="_blank">Seeedstudio</a> as I intend to use their Acrylic laser cutting service to create a top and bottom box to house the keyboard.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1QdtYzpe6VVdclCk8c67Gz6pY-H4IHLQrVkqFZykzkceDaSFt9pIyfPVXL4Q5cvK_sD03X48JvxH8WYE1hiinC_Wwl-lwb5vQ0R3oeHrs1_uI1vLE4ayOFuBzmLXK2p1F8Khj9mMWfmg/s1600/CopyPaste_proposal.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1QdtYzpe6VVdclCk8c67Gz6pY-H4IHLQrVkqFZykzkceDaSFt9pIyfPVXL4Q5cvK_sD03X48JvxH8WYE1hiinC_Wwl-lwb5vQ0R3oeHrs1_uI1vLE4ayOFuBzmLXK2p1F8Khj9mMWfmg/s1600/CopyPaste_proposal.JPG" height="243" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Keypad Concept</td></tr>
</tbody></table>
<br />
Due to space availability I placed the Leonardo PCB on the underside of the PCB, this did mean that it was a bit fiddly soldering the pins for the Leonardo as I didn't want any pins sticking through the PCB into the body of the switch so solder the pins first and make sure they are flush with the button side surface, NOT protruding.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnBTStTUezl-B3pgnIRD2Htluqckg3iHw1IRd88W0F6AWri-gHDXdEEMxyvRbF5DOr1o_riesdLD2GKhyGhOJof0nfeJU_-DLGnZr3jm_qoXqP1UqnEHkZmpyqAd8uCASNVPp6RTsYYQY/s1600/CopyPaste_3.jpg" height="216" style="margin-left: auto; margin-right: auto;" width="320" /></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8000001907349px;">Make sure the pins don't go too far through.</span></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKvPntGUf-P4FbB9NUj4wWis8dB35RFQ0ZXIy5bbzJqmL4S9zPSn_aDvIlABW3hgO42cQqQD5yDm24hlxzFKin33aoHYgnhX8_tBRDKRD-dE1xg-6KjpZrxwEmwR6evA6RS1YyCwpAS2E/s1600/CopyPaste_1.jpg" imageanchor="1" style="clear: right; display: inline !important; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKvPntGUf-P4FbB9NUj4wWis8dB35RFQ0ZXIy5bbzJqmL4S9zPSn_aDvIlABW3hgO42cQqQD5yDm24hlxzFKin33aoHYgnhX8_tBRDKRD-dE1xg-6KjpZrxwEmwR6evA6RS1YyCwpAS2E/s1600/CopyPaste_1.jpg" height="216" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The pins can be trimmed</td></tr>
</tbody></table>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Everything is powered by the USB lead plu</span><span style="font-family: inherit;">gged into the PC and there is an optional SMD or 3mm TPH LED on the button side that connects to a PWM capable IO pin, I set this to indicate power at 7% duty cycle and then pulse to 78% duty cycle for 50mS whenever a key is pressed.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
I've ordered the acrylic tops and bottoms from Seeedstudio but they've yet to arrive.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
All the files, including the Eagle schematic, PCB, gerber files and the sketch are <a href="https://dl.dropboxusercontent.com/u/2253850/CopPaste.rar" target="_blank">here</a>.</div>
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-32540409763849326152014-07-02T20:48:00.000+01:002014-07-02T20:50:37.210+01:00External Wireless Temperature measurementThis project was required so that I could monitor the temperature inside a temporary lean-to / greenhouse I made to winter some frost hating plants in.<br />
<br />
There are basically two modules, the transmitter and the receiver.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIMjrAo5DjaHQAB_9rwojgXji_KwzaNfQ-Ixto_dJ-SbvIi-yJ-NQx8mx9054PfYJ60sDdhnvz-lJYFBd2K43eUtowWr3QF4UE3uj9sT1zm5PeOdz-TPL6Zix7nAVVTV3pujBhxZw4frg/s1600/Temp+receiver.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIMjrAo5DjaHQAB_9rwojgXji_KwzaNfQ-Ixto_dJ-SbvIi-yJ-NQx8mx9054PfYJ60sDdhnvz-lJYFBd2K43eUtowWr3QF4UE3uj9sT1zm5PeOdz-TPL6Zix7nAVVTV3pujBhxZw4frg/s1600/Temp+receiver.jpg" height="246" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Receiver</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjctYRAgYRrGzuSVn19Y5B8hf0Ia2xCPAkfQJx1bbrORLHsWa3XL69dXl69X1jN7j7wkf09WurFcmblZfGgiq6FPgVT0f3AfY9D-FmC3CHiWz1Ci9yiNceGSgwyzg3CT1TXpOkIWu50YiE/s1600/TempTransmitter.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjctYRAgYRrGzuSVn19Y5B8hf0Ia2xCPAkfQJx1bbrORLHsWa3XL69dXl69X1jN7j7wkf09WurFcmblZfGgiq6FPgVT0f3AfY9D-FmC3CHiWz1Ci9yiNceGSgwyzg3CT1TXpOkIWu50YiE/s1600/TempTransmitter.jpg" height="246" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Transmitter</td></tr>
</tbody></table>
The transmitter uses a Jeenode from <a href="http://www.digitalsmarties.net/" target="_blank">Jeelabs</a> to read the temperature from two DS18B20s, one inside the greenhouse and the other in the form of a probe placed outside the greenhouse to measure the ambient temp.<br />
<br />
The receiver uses one of my own PCBs which is essentially a jeenode with an added uSD card slot, the display is from Jeelabs and is designed to sit directly on top of a Jeenode but it's not the cheapest display you can use. The receiver can also be made using a standard Jeenode instead of my PCB.<br />
<br />
I run the transmitter off some old lithium rechargeable 1850 cells taken from an old laptop battery, the receiver also runs on a lithium battery from a mobile phone but you can use any batteries you like from 3 to 5 V.<br />
<br />
The battery voltages of both the transmitter and receiver are monitored and displayed on the LCD, the code for the battery monitoring was taken from the Jeelabs blog <a href="http://jeelabs.org/2012/05/12/improved-vcc-measurement/" target="_blank">here</a> and the sleep functions were also from the same post using the Jeelib libraries.<br />
<br />
Sketches can be downloaded for <a href="https://dl.dropboxusercontent.com/u/2253850/TransmitterSketch.txt" target="_blank">transmitter</a> and <a href="https://dl.dropboxusercontent.com/u/2253850/ReceiverSketch.txt" target="_blank">receiver</a>.<br />
<br />
Any questions or comments, feel free.<br />
<h3>
</h3>
<div>
<br /></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<br />
<br />
<br />
<br />
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0tag:blogger.com,1999:blog-4455987088008622536.post-36897292729439524042014-01-27T20:29:00.000+00:002017-06-20T20:22:53.179+01:00Monitoring Data with the Arduino and ThingSpeakIn conjunction with my last post I thought I would monitor my hot water tank to track the temperature variations throughout the day, mainly to use the temp change to identify when someone has taken a shower and judge the need to heat the water up so there is some left for bed time (this will be done automatically by the Arduino code).<br />
<br />
First I searched around for a free cloud data storage solution, I'd used Pachube/COSM previously but COSM had changed hands again and I found it was always a bit unreliable for me anyway.<br />
<br />
I tried <a href="http://nimbits.com/">Nimbits.com</a> first of all but found it quite difficult to get the UNO working with the code on offer and the help information was a bit of a mismatch with sample code not being up-to date with the latest API, having said that the forum was well supported and I got quick answers to my questions. The main problem is that when I got it working my data on the graph contained random values which made the chart useless, I thoroughly checked the values that I was posting and the spurious data was not coming from me. One plus was that they had an Android app on the Appstore so viewing the data was easy.<br />
<br />
I then tried <a href="http://www.thingspeak.com/" target="_blank">ThingSpeak</a>, getting the UNO/Ethernet shield up and running was a lot quicker and I was posting temperature values within minutes. Another nice feature was the ability to clear the current data from the channel, ideal when logging data during development that's not relevant to you actual job.<br />
<br />
The chart looks nice, updates continuously and if you hover over the points a nice panel pops up with the data point details.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsTaSwCcbC7s5HfED2dAeFzS6_gLtOzk5SmLrK9GhqFA16itl2S9HohWRPgzJ3eaWp_tloZmfRXrN7TZbDAat1N_WpH4fI9RI4pHJ5WgtmO8lO5Ifd6zTMmYAj9k0le6_MkI1_qRzN5WY/s1600/chart.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="307" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsTaSwCcbC7s5HfED2dAeFzS6_gLtOzk5SmLrK9GhqFA16itl2S9HohWRPgzJ3eaWp_tloZmfRXrN7TZbDAat1N_WpH4fI9RI4pHJ5WgtmO8lO5Ifd6zTMmYAj9k0le6_MkI1_qRzN5WY/s1600/chart.png" width="640" /></a></div>
I've only just scratched the surface of ThingSpeak so there's still loads of stuff I just don't know about but it definitely enabled me to get up and running very quickly. One thing missing from ThingSpeak was a dedicated Android App but after a couple of hours with App inventor I was able to put together a usable App that lets me view the data whilst out and about (sad I know).<br />
It is also possible to embed the charts into other web pages using an Iframe.<br />
There are plugins that can be created, there is a sample of a Google gauge but I still can't get it to work. The forum doesn't seem to be as well supported as the one on nimbits, maybe there are less users.<br />
<br />
The App inventor source can be found <a href="https://www.dropbox.com/s/xoquaubolfjo52y/ThingSpeak1.aia?dl=0" target="_blank">here</a>. (updated to appinventor 2, import the aia file to app inventor 2)<br />
The APK file can be downloaded <a href="https://www.dropbox.com/s/7gq3njya9zkpznm/ThingSpeak1.apk?dl=0" target="_blank">here</a>. <br />
After running just type in your channel number and read key and click "set" and then "update"Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com5tag:blogger.com,1999:blog-4455987088008622536.post-55424684458820323732014-01-21T20:19:00.002+00:002014-01-21T20:23:05.457+00:00Central heating control using SMS and the ArduinoOne of the things I set out to do after discovering the world of Arduino was to make myself a clever controller for my central heating but, not unusually for me, my focus wandered here and there finding new and probably easier things do do with all these little gadjets.<br />
<br />
I got back into air rifles which meant most of the blog, over the last few months, has been full of my various versions of a chronograph! I've tried loads of different displays and even Bluetooth to get the speed of the pellet to my phone.<br />
<br />
Anyway, the weather turned cold again and thoughts drifted toward the central heating again but this time something a bit simpler, something to switch the heating or water on for a period of time without leaving the comfort of my arm chair.... yes I'm that lazy.<br />
<br />
I'd dabbled with the 868MHz RF links, Bluetooth links but after coming across a post on <a href="http://nathan.chantrell.net/20130604/sms-with-the-wavecom-wmoi3-gsm-modem-and-arduino/" target="_blank">nathan.chantrell.net </a>I found a source for a cheap GSM modem.<br />
<br />
My original thoughts were to bow to the latest fashion of "IoT" but my dealings so far with the Arduino and Ethernet interfaces had been less than perfect, quite randomly the data flow would just stop and I never got to the bottom of it. The SMS solution appealed because I don't need a data connection or even a smartphone and can switch the heating on before I get home even if the raspberry pi and the arduino etc. are switched off when I'm on holiday. The SMS route seemed like a good solid proven technology.<br />
<br />
The Modem was an ex-equipment modem from some old BT security line monitoring equipment (search "redcare GSM" on Ebay) and I picked up mine for £4 including delivery, not too expensive, the SIM card was an old Giffgaff card from a previous phone which still had few quid in credit and my contract phone had unlimited texts ... so I thought I would give it a go.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJKoB8OjxtMHIUpwtW38YJvTt9tTW6ESFPH3nvjolGVO655BWDKeAFnJttcbtibtv4bAodyu9Fp-hvUvhgzJ99fJrR3f3gGFEEbqDInU8i4pBraW02Hi72l39IRq9vIK_BddfoUwA_Wf0/s1600/CH_System_overview.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJKoB8OjxtMHIUpwtW38YJvTt9tTW6ESFPH3nvjolGVO655BWDKeAFnJttcbtibtv4bAodyu9Fp-hvUvhgzJ99fJrR3f3gGFEEbqDInU8i4pBraW02Hi72l39IRq9vIK_BddfoUwA_Wf0/s1600/CH_System_overview.jpg" height="433" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">The overall system laid out on the desk</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
The modem came with an external antenna and the 2x50 header still attached to the PCB which was quite lucky because the connector is a 1.27mm pitch IDC on a ribbon cable, to get connections to the modem I used a hot air gun to sweat off the SMD connector from the PCB.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I made the connections to a standard pitch connector so I could interface to the rest of the system, the pins are very small and it wasn't easy.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
The idea was to connect the the relays in parallel to the existing relays in the controller so that the current timer based operations would continue but I could switch on the heating or water remotely. The relays would be switched by the Arduino Mini Pro via a soft serial connection from the modem, there was also an I2C OLED status display and a remote temperature sensor for the hot water tank. Initially the temp sensor would just monitor the water temp and be sent to the phone on request but I intend to use it later to give a finer control to the water temp (I might log temp to and SD card for a while to get an idea of usage).</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The SMS control takes the form of a simple short message coded for heat or water and a duration, heat on for an hour would be H60 whereas heat for 2 hours would be H120 ... I said it was simple. Hot water just uses a "W" instead of a "H". There is also the function to request the temperature of the water, this causes the Arduino to send an SMS containing the temperature of the water.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaiB9xdQjC8Pc98SFNFlEPA2j1lQ2pOn-HMKycOcW3Nwtr-Td0m5-hos5HTMShz87b7QiC1PpL9ZheoAUbn-2PY7sx568GOngombWkOUDXr3TG7MkkJ5XV1GP8IeNUQjSuS18BchmreDs/s1600/CH_APP.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaiB9xdQjC8Pc98SFNFlEPA2j1lQ2pOn-HMKycOcW3Nwtr-Td0m5-hos5HTMShz87b7QiC1PpL9ZheoAUbn-2PY7sx568GOngombWkOUDXr3TG7MkkJ5XV1GP8IeNUQjSuS18BchmreDs/s1600/CH_APP.png" height="320" width="180" /></a>The control is done by an App on my Android phone but could be done just as easily by sending a text normally or there are some automation apps that would allow a pre-defined text message to be sent from an icon on your home screen. Actually I suppose you could control your central heating system from within an app such as Tasker, Tasker would allow you to setup timed text messages to carry out the operation, this would only make sense if you get free text messages though. <br />
<br />
The Arduino code checks the incoming phone number to make sure it matches the one(s) you allow to control the heating and the response to the hot water temp request is sent back to the requestor's phone.<br />
<br />
I'm also thinking of connecting in to my alarm system to send out an SMS when it gets triggered.</div>
<div class="" style="clear: both; text-align: left;">
That's all for now, I'll post a link to the Arduino code and the Android app in the next post.</div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
There's plenty of technical information on the modem and links to a SMS messaging library on nathan's blog post <a href="http://nathan.chantrell.net/20130604/sms-with-the-wavecom-wmoi3-gsm-modem-and-arduino/" target="_blank">here</a>.</div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
Please feel free to ask any questions or make suggestions in the comments below.</div>
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com6tag:blogger.com,1999:blog-4455987088008622536.post-50868876548335061312013-11-06T22:53:00.002+00:002013-11-06T22:54:53.260+00:00Another update to the OLED 1602 LibraryI've made a change to the 1602 OLED library and also added a new function.<br />
<br />
I've modified the sendString() function to now include the cursor position data and added a new function called sendFloat(), this allows you to send float data values, such as temperature, to the LCD ant it gets converted to a string before being sent to the display.<br />
<br />
The sendFloat function takes the following parameters: float value, minimum length inc. decimal point, number of positions after the decimal point, the start column position, the start row position.<br />
<br />
I've updated the library in my GitHub repository <a href="https://github.com/gadjet/1602-OLED-Arduino-Library" target="_blank">here</a><br />
<br />
Please note that older sketches using the sendString() function will not work with the new library and will need to be altered.<br />
<br />
/*<br />
Demo sketch to display Strings and float values on the OLED<br />
1602 display from Wide.HK. This uses a Lbrary that I've<br />
put together containing some basic functions.<br />
The I2C Address is set to 0x3C in OLedI2C.cpp<br />
Phil Grant 2013 www.gadjet.co.uk<br />
*/<br />
<br />
#include "Wire.h"<br />
#include "OLedI2C.h"<br />
OLedI2C LCD;<br />
float digit;<br />
<br />
void setup()<br />
{<br />
Wire.begin();<br />
LCD.init();<br />
digit = 21.6;//This would normally be the float value returned from a temp sensor or other sensor<br />
}<br />
void loop()<br />
{<br />
LCD.sendString("Temp",0,0);// now includes the cursor position data (col, row)<br />
LCD.sendFloat(digit,5,2,7,0);//Send the string to the display<br />
while(1);<br />
}<br />
<br />Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com43tag:blogger.com,1999:blog-4455987088008622536.post-79072774896839676032013-10-26T20:15:00.000+01:002013-10-26T21:02:16.189+01:00Updated wide.HK OLED 1602 Library<span style="font-family: inherit;">Thanks to Nathan from <a href="http://nathan.chantrell.net/">http://nathan.chantrell.net/</a> there is now a scrolling function in the Library.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">This allows you to specify some text, the line to display it on and the speed to scroll it at.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Sample code by Nathan (modified by me to remove the scrollString function as it's now in the library).</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="background-color: white;"><span style="font-size: x-small;">/*<br />Scrolling demo on the OLED 1602 display from Wide.HK. <br />Uses Library by Phil Grant http://www.gadjet.co.uk<br />Scrolling by Nathan Chantrell http://nathan.chantrell.net<br />*/</span></span><br />
<span style="font-size: x-small;">#include "Wire.h"</span><br />
<span style="font-size: x-small;">#include "OLedI2C.h" // http://www.gadjetsblog.blogspot.co.uk/2013/09/oled-1602-display-and-library-for.html</span><br />
<div>
<br /></div>
<span style="background-color: white;"><span style="font-size: x-small;"><wire .h=""><oledi2c .h="">OLedI2C LCD;<br /><br />void setup() {<br /> Wire.begin(); <br /> LCD.init(); <br /> LCD.clearLcd();<br />}<br /><br />void loop() { <br /> scrollString("Slowly scrolling text on line one...",0,200);<br /> scrollString("and faster on line two...",1,100);<br />}</oledi2c></wire></span></span><br />
<div>
<br />
Download here: <a href="https://dl.dropboxusercontent.com/u/2253850/OLED1602I2C.rar" target="_blank">Updated OLED 1602 Library</a><br />
<br />
Now on <a href="https://github.com/gadjet/1602-OLED-Arduino-Library" target="_blank">GitHub</a></div>
Gadjethttp://www.blogger.com/profile/03523239254572573477noreply@blogger.com0