ESP8266 and the Arduino IDE on macOS

Won't Connect

Doesn’t work. Fucking go figure. There’s always something to cause a problem. If you have been following the last few posts I’ve made you would see that I have been working on ESPs all weekend. I finally got a new TTL adapter that works with the ESPs and have been playing with ESPlorer and LUA code. I decided to switch over to the Arduino IDE since there seems to be more support and tutorials for it. Well it won’t connect.

That is what I am greeted with. Well after about an hour of trying different shit I found this tidbit on the Github for Arduino issues: This is because esptool-ck doesn’t work with PL2303 based converters on OS X. Fucking great. Thats what I just bought, so I could flash the chips again. So I fired up Virtual Box and Windows 7, downloaded/installed all the needed Arduino shit and drivers and blah blah. Opened a blank sketch in the IDE, selected the ESP board and hit upload. BAM! Shit worked. Took daaays, but it worked. Fucking Apple. Looks like I’m stuck to a Windows machine no matter what I do. Sad face.

Update: So after flashing via Windows in Arduino IDE and it working I went back to macOS to try again. I changed “ck” to “nodemcu”, which didn’t work at all. So I changed it back, thats when it started working. I still had to do the reset-flash-dance. Ground GPIO02 and reset, once booted release GPIO02 and set it high, or let it float. That should put you in bootloader mode so you can flash via the Arduino IDE. I also noticed that I cannot switch back and form between the IDE and ESPlorer. They don’t play nice together. If I want to switch I have to reflash the ESP firmware. That sucks. Picky ass modules.

I can finally flash again

I finally did it! I was able to flash my ESP8266s again. It only took months and a bunch of scratching my head – then banging it against a wall. I cannot even really remember where I left off with my programs, but I do recall I stopped because I wasn’t able to flash my chips anymore.

USB FTDI
USB FTDI
ProMini
ProMini
WiFi Module ESP8266-01
ESP8266-01

That was a big problem obviously, and I do not know why it started as all was well in the beginning. I originally had ordered a few ESP8266-01s and some Arduino Mini Pros. I figured they would work well together. To go with the Mini Pros and ESPs I nabbed a USB FTDI programmer and it worked fine when I initially got it. I was able to send AT commands to the ESPs and program my Mini Pros no problem. Then I started playing with flashing new firmware on the ESPs to try NodeMCU, and I think thats where everything started to go downhill. The FTDI and ESPs would stop communicating half way through flashing. Eventually I couldn’t flash or upload anything anymore. It just wouldn’t go. Fast forward a months later and I ran into a few posts that mentioned the FTDI chips are unstable with the ESPs and won’t work. Hmmm. They all recommended using a USB TTL adapter instead.

So thats what I finally did, purchased a USB TTL adapter off Amazon for $6. I got the Armorview PL203HX adapter. USB plug on one end and four breadboard connectors on the other for PW, GND, RX and TX. Simple. As soon as I got it I plugged it in and… nothing. A ls /dev/tty.*  yielded nothing. WTF. I probably need a driver. Yup, the PL2303 driver was needed in my case. Installed that and plugged the adapter back in and now I see it tty.usbserial . Nice and generic. First thing I tried was flashing the AT firmware to an ESP. And it worked!!

I can now flash firmware to the ESPs again, and the Arduinos if I wanted to but the FTDI still works fine with those. For those that want to know; I use a breadboard power supply for powering the ESPs and Arduinos. I only use the USB adapters for communication. You can and I have done it without it, but it is just way more stable to use the extra power supply. The adapters don’t have the juice, especially for the ESPs. Now I can get back to tinkering again.

See this post for how I got the ESP to send MQTT data

See this one for how I got send and receive to work with MQTT

Send and Receive MQTT data

MQTT

I made a post last year on how I was finally able to get the ESP to send MQTT data. I had forgotten all about that when I was able to flash the chips again, so I started digging for how to do it. I basically came across the same code somewhere else (can’t remember where), but this time I was able to get send and receiving to work. Decided to share. Once uploaded to the ESP you can see the printed results in the buffer window (I use ESPlorer). Code is below.

 

Moving your Dropbox Folder (macOS)

Dropbox

I have a Mac Pro, it has an SSD. A small one, only 256GB. To combat this I have like everyone else, an external USB (3.0) hard drive. Well I didn’t put much though into Dropbox when I installed it like how much I would use it, and how big the folder is going to get. With all my recent hard drive failure and data loos I am scrambling to do what I can to protect my data now. Better late than never.

The default location for the Dropbox folder is your home directory. If you have a big enough hard drive this will work out just fine. But as I don’t, it did not. I realized I was going to need more Dropbox space, no biggie, they have an upgrade option. OK cool. Ah but hard drive space… that’s an issue. I do have 3TB of external space, so I am not running out of space, just was going to eventually run out of space on the small main drive. The Dropbox upgrade gives you 1TB of backup. I would like to utilize this space as much as possible. It just happens to be that I have an empty 1TB partition on the external drive. Perfect.

Now I need to relocate the folder. Well, the Dropbox app on macOS has a built-in feature to do this. Naturally it didn’t work. It copied the files and folders 100% but then it said I had errors, but wouldn’t tell me what – typical Apple. I tried a few more times. I tried pausing sync first. I tried uninstalling the app. Nothing I tried seemed to work. Then I found the fix for my issue. I unlinked the account. That seemed to delete all the preferences associated with the folder location. I was then able to relink the account and choose the starting location. It worked. Then I paused sync, closed the app and copied the files over manually to the new location real quick so I didn’t have to re-download them all. Restart Dropbox and a few minutes later it was all happy.

I hope you see this BEFORE you install and use Dropbox, but probably not. So hopefully this helps you after the fact.

Forced HTTPS

HTTPS

Since HTTPS is the way of the future, and my host provides it for free why not implement it? So I have added the necessary code to force you to HTTPS on itsalllost.com. All should be well, if not better (I hope).