Posts

Showing posts from 2020

ESP8266 connection to MQTT server (Attempting MQTT connection...failed, rc=-2)

Recently I had a problem when trying to program NodeMCU with Arduino. I flashed arduino with basically default pubsubclient test program. After programming NodeMCU connected successfully to Wifi, then tried to connect MQTT server and failed: WiFi connected Attempting MQTT connection...connected ............Attempting MQTT connection...connected ............Attempting MQTT connection...failed, rc=-2 try again in 5 seconds I researched and tested many Arduino scripts. All failed with the same error -2. I logged into the MQTT server and watched logs. The NodeMCU didn't even connect to the MQTT server. I was clueless. Luckily I bought a few NodeMCUs from different sellers. Opened up another NodeMCU and hooked it up. Flashed the exact same code to it and it connected and worked like charm. Then I tried to flash the first problematic NodeMCU with Arduino and exactly the same error -2. I had also a ESP12E that had the -2 error before. Flashed it with the same code, still error -2.

Making PCBs with 3D printer

Image
I always wanted to make PCBs at home. I have tried most of the processes from the internet to make PCB-s (by hand with marker, with printer and glossy paper, ....). Recently I got 3D printer and thought that the precision should be enough to make simple PCBs with it. So I searched from internet and found this page: http://www.lamja.com/?p=635 I had some old rod from an old printer from scrap. Next I designed a rod holder that would fit the printer. The printer is modified Ender 3 and has new cooling. So the rod holder had to be designed from scratch. I found some usable size spring that I made a bit bigger. I tried the process with marker and it worked but the result was not very good. So I had a idea to use nail polish and scrape that off with the rod. I used some random old nail polish. This resulted much better PCB board than the marker. Other parts of the process are the same as the link above. I had some trouble to get the *.svg file to FlatCam, because FlatCam
Image
Automatic greenhouse door opener Goal Opening the greenhouse door automatically when the room gets too hot. I have set it to 24 degrees C that the door opens and door gets to maximum position when there is 32 degrees C. Used hardware In box Arduino Nano clone - main "brain" of the project 5110 LCD - LCD to show info DS18B20 - temperature sensor SRD-05VDC-SL-C - 2 relays LEDs x 6 - for indicators Resistors Capacitors - 3x Level shifter 5V->3.3V 7805LM - 12v to 5v 10A fuse and fuse pcb mounts PCB screw terminals On door Car side window lifting motor and mechanism Magnet and PS-3150 Reed Switch Switch - for door "homing" bolts, nuts, threaded bar Software I wrote code for the arduino to control the door. Arduino checks if the home swich is pressed. When home switch is not pressed the arduino tries to close the door. When door is closed now the arduino knows the "0" place. Measuing temperature. When temp is <24C then does not