It is some time ago, but finally a new project from me.
The idea was to make an light sensor for my domotica that will communicate with my Mosquitto Mqtt broker over wifi, the old light sensor was cast in epoxy but due the weather the epoxy got discolored and is not working therefore anymore accurate. And with accurate I meant not at all anymore. The TSL2561 was very interesting to use as sensor. There are some nice Arduino library’s that are very complete.
During design there was also a temperature sensor (DS1820) and decibel meter (MAX4466 module) added. Don’t know if the decibel meter will be accurate, but it’s just for logging the airplanes flying over my house. The decibel meter will later be calibrated with an real decibel meter, we will see how accurate this is.
The design started with finding a suitable enclosure, water resistant and suitable for measuring light. On ebay I found a nice one and not that expensive $8,00
When the sensor was in I first took it apart and see what the possibilities are with the enclosure.
A round pcb with a diameter of 63mm was needed. I want to design the board with Altium Designer to get more familiar with this pcb design software. Easier said then done.
It’s my 4e design with Altium, but because of the round pcb and the strange angles that some of the components must placed it took some time to get it all finished. But it was all very educational.
The first ideas was to use the new ESP32 module, would be nice to use this very powerful mcu in the design, but there was no room enough. Next time if there’s not enough room I will not use the ESP32 module, but just the ESP32 mcu. Due the connector in the center of the pcb with it’s mounted to the enclosure there was not that much space as it looks like. Because of the limited usable space i used the good old EPS8266 module, the Esp-12.
Pcb is ordered, story will be continued.
It took some time to finish this project. Due some stupid and unseen design faults I had to redesign the pcb 2 times.
In V1 I was completely forgotten that the ESP8266 has an AD convertor with a max input of 1V and the microphone amplifier was spitting out Vcc and that’s is 3.3V.
After adding a voltage divider in V2 the mic amplifier was sensitive to the noise on the Vcc rail and added a lot of switching noise to the output of the amplifier.
In V3 there was a lowpas filter added in the power supply line to the mic amplifier and that did the job, smooth about from the amplifier.
Still not all problems solved, the mic amplifier didn’t amplified enough and after some testing I noticed that in the original design from Adafruit they used an 100K pot meter and my amplifier from Ebay had a 10K resistor. After replacing that everything worked fine and the data is coming in nice. Except the temperatuur sensor, because it’s inside the enclosure it doesn’t measure accurate.
Pcb design front Altium
Pcb design back Altium
Sensor orginal split
Sensor original inside
Sensor original pcb
Finished pcb top view
Finished pcb mounted in housing
Finished sensor hanging outside
If you want to make your own, or use some parts. Altium 16 Schematic and pcb files.
My Samsung Clp-315 color laser printer showed me a red online led. Because this means general error you need to connect it to the pc to see what the problem is in the Samsung Smart Panel. My printer is normally connected to a printer server so the it’s not right away clear what the error was.
Smart Panel told me that there was “Toner waste bin full or not present” error, strange because there was a bin and it wasn’t full.
In the past the printer was transported without the cap on the waste bin, during that moment there was some toner spilled in the printer.
This toner was now blocking the light sensor and therefore the printer was thinking that the bin was full.
After cleaning it all was working fine again.
I think this same solution can work for other Samsung printers from the CLP-3xx series, give it a try.
Found this interesting Wifi power switch on Ebay for only $6,11. It’s not clear to me if this is the original design or a copy of it. Detailed info can be found on this Wiki page.
To connect it to my Mqtt broker and domotica I wanted to make my own firmware.
Easy said, easy done. There are plenty example on the net how to do this. Because there’s an esp8266 inside there are also numerous Arduino software example available.
First step was soldering a header to the empty programming socket and connect my Usb to serial adapter to it. Take a note that you must have a 3.3V usb to serial adapter, they can be found for under a dollar on ebay. Don’t know how they can make it for that amount and even send it to the other side of the world.
Connected the usb adpater to my pc and voila, I’m in. Keep also in mind not connect it to the mains when connected to your pc. Both powersupply’s are not happy with each other.
Simple led blink program was working, connecting to wifi was also working, but unfortunately the red led and ota (over the air) update was not working.
The ota was complaining that the authentication was not correct and I was sure it was correct.
After lot of Googleing and some tries it was clear that the memory settings in the Arduino ide where not correct, but what must it be then?
This setup was working for me, cant say it will work for all Sonoff versions, but you can try setting the ide like this. /* Gerneric Esp8266 Module: Flash Mode: DIO, Flash Frequency: 40MHz, CPU Frequency: 80MHz Flash Size: 1M (64K SPIFFS), Debug Port: Disabled, Debug Level: None, Reset Method: ck */
Now the red led.
In some Arduino code that I found they say that the red led will lit when the relay will be activated. But both didn’t work. Red led and relay didn’t worked. Relay was simply fixed, it needed the 5V from the Sonoff build in power supply, connected to the mains and the relay worked, but still no red led.
Looking at the schematic and the pcb some critical components for the led where not placed. Q3, Q4, R2 and R23 are not placed.
Q3 and R2/22 are used for the Sonoff version that have also the 433Mhz receiver. Q4 and R23 are used to lit the red led if the relay is activated.
Both are not placed, so that’s why the led will not lit. If you want to let the red led work together with the relay, just place Q4 (2N7002) and R23 (1K) and it works.
However I wanted the red led under software control and decided to use one of the free gpio ports from the Esp8266.
Soldered a wire from gpio4 (pin16) on the Esp8266 to the drain of Q3. See the pictures below for details.