Difference between revisions of "MM Defender IOT Controller"

From PalOMoney
Jump to navigation Jump to search
m
Line 1: Line 1:
Stay tuned for this topic, under construction.
+
I stupidly blew up the PIC controller. The only alternative was a new controller. I looked at Arduino boards, which have a robust environment community. However, I just discovered the Espressif Systems ESP8266 WIFI chip, which has very limited computing capacity, but WIFI connectivity! I purchased a couple of very cheap development boards, and programmed a new controller using the data below, and wired it into the board in place of the PIC controller. Today it is working, catching hundreds of hungry mosquitos in its first day of operation. Plus, I can check it and the combustion chamber temperature from my PC or phone. What more could I ask?
  
[[File:MMDefender NodeMCU Schem 1r0.png]]
+
Actually, I could ask quite a lot more. Here is the first revision schematic.
 +
 
 +
[[File:MMDefender NodeMCU Schem 1r0.png|1024px]]
 +
 
 +
The $4 NodeMCU ESP-12E wireless development board provides greatly improved troubleshooting. Temperature is measured using the 12 bit ADC input buffered by a 220k/100k divider to give a 3.2v full scale input. R6 (20k) drops 3.3 volts so that an open thermistor TH201 yields about full scale. ThermLo connects to U301 D5 open drain that is switched on and off to add and remove TH201, yielding a voltage ratio to calculate its resistance then temperature.
 +
 
 +
The software implements an MQTT client that publishes its status 'topic' to an MQTT broker for viewing on a PC or phone app. It can also receive commands. A simple web page can also be implemented. WiFi configuration is done with the unit in access point mode so you can enter a wifi SSID and password.
 +
 
 +
[[File:71DMo7akIQL._SL1200_.jpg|512px]]
 +
 
 +
The development board has 2 rows of 15 pins on 100 mil centers to fit standard 100 mil sockets. I used a 15 pin socket for the right side, and a dual and single socket for the left side. Flexible stranded 6" color coded wires are soldered to the used pins. The foil from the +5v rail was cut. +3.3v from the NodeMCU board powers the circuitry, which seems to work (power the LED, Q1 gas driver, and the two FETs for the fan and igniter) most of the time. The foil from C4 was also cut. The wires are soldered onto components or vias where possible - the largish wires can easily rip up a thin foil trace on the controller. The wires should be glued down or potted to the pcb for greater stability (later).
 +
 
 +
The controller drives 4 outputs: switch LED, Gas, Fan, and Igniter. It has a digital input to read the switch position. The analog input measures the voltage across the thermistor TH201 when the ThermLo signal is low. When ThermLo goes open drain, it measures the +3.3v power supply voltage divided by the 20k resistor and the adc input. This ratio measurement technique is intended to compensate for variations in the +3.3v rail plus other temperature variations.
 +
 
 +
The software is of the primitive "Hello, World" quality, lacking robust error recovery and the like. Still, it was capable of starting the running the trap. Currently, it connects to an open public MQTT broker server test.mosquitto.org and publishes internal temperature and state info whenever the temperature changes (sometimes once per second) to the /test/MMD/esp###### topic. You can look at that using an MQTT client. The address and topic is expected to change soon. This way, you can tell if the trap is running or not.
 +
 
 +
The software needs revision. It fails to re-connect to the server if the connection is lost. It does not respond to commands. You cannot set the wifi SSID and password without attaching a USB cable. It lacks its own web page. It is primitive in its control of the combustion process. Like the previous controller, there is sometimes a pop that sounds like a small explosion when the gas finally starts combustion. I would like to eliminate that, perhaps by increasing the gas levels gradually until a rapid temperature rise.
 +
 
 +
And so on, and so on. The trap needs to keep running to catch those too numerous mosquitos. When the catch dies down, I can update the software.
 +
 
 +
== June 13, 2018 ==
 +
 
 +
Last night, the trap would start then die as the internal temperature reached 130 C. It did this 3 times. The steady state was about 100-110 C, but initially the temperature climbs to about 150 C before it settles down. But the combustion stopped at 130 degrees, and it cooled all the way down to where the gas turned off and the fast blinking fault state entered. My guess is that the NodeMCU was getting too hot. I moved the board as far away from the combustion chamber as I could, and that worked. The whole system is marginal regarding heat and environmental conditions. We will see what happens during a thunderstorm. Again, my guess is that Q1 is losing drive and opening up, shutting off the gas at this temperature. I will have to instrument this to see what is happening. But now it is working, and the mosquitos are coming far and wide. Just keep going!

Revision as of 14:20, 13 June 2018

I stupidly blew up the PIC controller. The only alternative was a new controller. I looked at Arduino boards, which have a robust environment community. However, I just discovered the Espressif Systems ESP8266 WIFI chip, which has very limited computing capacity, but WIFI connectivity! I purchased a couple of very cheap development boards, and programmed a new controller using the data below, and wired it into the board in place of the PIC controller. Today it is working, catching hundreds of hungry mosquitos in its first day of operation. Plus, I can check it and the combustion chamber temperature from my PC or phone. What more could I ask?

Actually, I could ask quite a lot more. Here is the first revision schematic.

MMDefender NodeMCU Schem 1r0.png

The $4 NodeMCU ESP-12E wireless development board provides greatly improved troubleshooting. Temperature is measured using the 12 bit ADC input buffered by a 220k/100k divider to give a 3.2v full scale input. R6 (20k) drops 3.3 volts so that an open thermistor TH201 yields about full scale. ThermLo connects to U301 D5 open drain that is switched on and off to add and remove TH201, yielding a voltage ratio to calculate its resistance then temperature.

The software implements an MQTT client that publishes its status 'topic' to an MQTT broker for viewing on a PC or phone app. It can also receive commands. A simple web page can also be implemented. WiFi configuration is done with the unit in access point mode so you can enter a wifi SSID and password.

71DMo7akIQL. SL1200 .jpg

The development board has 2 rows of 15 pins on 100 mil centers to fit standard 100 mil sockets. I used a 15 pin socket for the right side, and a dual and single socket for the left side. Flexible stranded 6" color coded wires are soldered to the used pins. The foil from the +5v rail was cut. +3.3v from the NodeMCU board powers the circuitry, which seems to work (power the LED, Q1 gas driver, and the two FETs for the fan and igniter) most of the time. The foil from C4 was also cut. The wires are soldered onto components or vias where possible - the largish wires can easily rip up a thin foil trace on the controller. The wires should be glued down or potted to the pcb for greater stability (later).

The controller drives 4 outputs: switch LED, Gas, Fan, and Igniter. It has a digital input to read the switch position. The analog input measures the voltage across the thermistor TH201 when the ThermLo signal is low. When ThermLo goes open drain, it measures the +3.3v power supply voltage divided by the 20k resistor and the adc input. This ratio measurement technique is intended to compensate for variations in the +3.3v rail plus other temperature variations.

The software is of the primitive "Hello, World" quality, lacking robust error recovery and the like. Still, it was capable of starting the running the trap. Currently, it connects to an open public MQTT broker server test.mosquitto.org and publishes internal temperature and state info whenever the temperature changes (sometimes once per second) to the /test/MMD/esp###### topic. You can look at that using an MQTT client. The address and topic is expected to change soon. This way, you can tell if the trap is running or not.

The software needs revision. It fails to re-connect to the server if the connection is lost. It does not respond to commands. You cannot set the wifi SSID and password without attaching a USB cable. It lacks its own web page. It is primitive in its control of the combustion process. Like the previous controller, there is sometimes a pop that sounds like a small explosion when the gas finally starts combustion. I would like to eliminate that, perhaps by increasing the gas levels gradually until a rapid temperature rise.

And so on, and so on. The trap needs to keep running to catch those too numerous mosquitos. When the catch dies down, I can update the software.

June 13, 2018

Last night, the trap would start then die as the internal temperature reached 130 C. It did this 3 times. The steady state was about 100-110 C, but initially the temperature climbs to about 150 C before it settles down. But the combustion stopped at 130 degrees, and it cooled all the way down to where the gas turned off and the fast blinking fault state entered. My guess is that the NodeMCU was getting too hot. I moved the board as far away from the combustion chamber as I could, and that worked. The whole system is marginal regarding heat and environmental conditions. We will see what happens during a thunderstorm. Again, my guess is that Q1 is losing drive and opening up, shutting off the gas at this temperature. I will have to instrument this to see what is happening. But now it is working, and the mosquitos are coming far and wide. Just keep going!