I have a dream to have big makerspace in my house. Until I can buy new place I need to make do what I have. And I have storage room outside of my place. People before me has insulated that room so I can just install heater. But because I don't like doing stuff the normal way I want to try how would Crypto Mining rig heat the storage room. I want to see is small computer enough to heat small storage room. For that I started this project.
Electronics and debug to get them to speak
I have five ESP8266 ESP-01 version that I have ordered few years ago and one DHT21 or AM2301 whatever you want to call it. First thing was to get ESP8266 to work with me. When I bought them I didn't get them respond. I didn't believe those were broken but I didn't have enough interest to go with the debug.
ESP8266 uses 3.3V in Vin and in tx rx ports. So first I tested that my Serial TTL was able to do that. And they were.
When I started this project I tried few different Serial TTL´s I got some gibberish out of them but nothing else. I searched the web an noticed that it need CH_PD to be up when it is working. After that it started to give me something.
So wiring was
ESP8266 Serial TTL Vin ----> 3.3V Gnd ----> Gnd TX -----> RX RX -----> TX CH_PD --> 3.3V
Then I started to get something understandable out of it using baud rate 115200.
Next issue was that it seemed to be in loop. I tried few other chips and few of those seemed to be in bootloop too but others just gave the boot info and did not respond after that.
Back to reading and I found out that this little chip wants a lot of current. Maxes over 200mA. I tried to get it from Arduino Uno from computer usb, from usb hub with external power and 2.1A max, and direct 5V 2A external power supply. Nothing. Everything was as it were before. It seemed that it was drawing 60mA everytime.
So it seemed that I cannot give this device enough power with what I have home. Thankfully christmas was last month(well not anymore when I press publish). I just packed few led ribbons with 2x1.5V battery packs away. Tested one and it had some sort of electronics inside. Read the manual and there is a 6 hour timer of some sort. Don't want that. Other one was just direct switch and I got 3.2V out of it.
Decided that I can buy new one for next christmas I cut it out and soldered cords with breadboard connectors to it. Wired everything up and ESP seemed to be staying up but it didn't respond to my AT commands. Seemed odd but I wanted to try what it says to arduino.
Testing with Arduino Ide
It seemed that ESP had lost its firmware. I was not surprised. I tried few times to load some firmware to it as a test but it never worked. There could have been times that it was able to start it but with loss of power it rebooted the chip.
I tested example Blink from Arduino ESP library with default settings. It gave me could not access memory -error. ESP seems to picky what memory it uses. I have ESP8266EX P32N27 that has 4M memory. It needed that to be specified in the program.
ESP8266 Serial TTL Vin ----> 3.3V Gnd ----> Gnd TX -----> RX RX -----> TX CH_PD --> 3.3V GPIO ---> Gnd
Also ESP needs to have GPIO0 connected to ground when firmware upload is being done to access memory. So after right settings and right wiring I was able to get led blink. HOORAY. This took me few weeks on and off. Lots of frustrated times ended with a beer.
Code for sensor
I haven't decided if I'm going to have a server that is read in HTML or an client that sends data to server. There are some advantages on both.
For the start I tested the server version and for that I just used an example from ESP Arduino library. Which worked out of the box. That was surprising. Then I downloaded Adafruit DHT library. And that didn't work out of the box. It needs an general Adadfruit sensor library. I was lazy and just copy pasted the file to DHT library. After that my sensor came to life.
I started to combine all need parts of the codes. Got it working after few tries. You should not delete code villy nilly and not checking what you have selected. It might mess everything up. I had deleted Void loop for some reason.
After stupid mistakes I got the thing working.
I'm going to try my first order of custom PCB and for that I need to design it. This will be good test. It is quite simple design and most of the parts will be just connectors. With that I'm going to publish my sources for this. I will make some adjustment for the examples. I want it to have at least a static IP.