User avatar
marine_hm
Posts: 82
Joined: Tue Mar 07, 2017 4:27 pm

Re: Which operating system for Pi Zero W as access point, MQTT only

Tue Aug 14, 2018 1:08 pm

Well damn! I find it easier to just pull out the ESPs and modify the sketch and plug them back in.
I guess I'll be toting a laptop and screwdriver around.
Frustrating but least difficult!

Heater
Posts: 13093
Joined: Tue Jul 17, 2012 3:02 pm

Re: Which operating system for Pi Zero W as access point, MQTT only

Tue Aug 14, 2018 7:00 pm

Hmm... can you run an MQTT broker on an ESP ?

I doubt it.

User avatar
DougieLawson
Posts: 35798
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Which operating system for Pi Zero W as access point, MQTT only

Tue Aug 14, 2018 7:46 pm

Heater wrote:
Tue Aug 14, 2018 7:00 pm
Hmm... can you run an MQTT broker on an ESP ?

I doubt it.
You can run Nick O'Leary's pub/sub client code: https://github.com/knolleary/pubsubclient
But you can't run a broker.

The broker can be anywhere in the internet (LAN or WAN).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
bensimmo
Posts: 4152
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Which operating system for Pi Zero W as access point, MQTT only

Tue Aug 14, 2018 8:18 pm

marine_hm wrote:
Tue Aug 14, 2018 12:28 pm
Just to try out a theory to make sure it's working correctly. I changed the sketch on one ESP8266 sensor so that the MQTT server IP was the same as the new Pi Zero W when I type ifconfig

// Connect to the WiFi
const char* ssid = "PiCharts";
const char* password = "Espressif";
const char* mqtt_server = "192.168.4.1";

It does log on and works correctly. So my issue now is NOT with MQTT but assigning the Pi Zero W's IP address to match the IP address from the previous Pi Zero W. Just so I'm not pulling apart a bunch of sensors to change the IP address in the individual sketches.

I did it with this tutorial: https://www.raspberrypi.org/documentati ... s-point.md

Two lines that I'm looking at :
sudo nano /etc/dhcpcd.conf

interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant

sudo nano /etc/dnsmasq.conf

interface=wlan0 # Use the require wireless interface - usually wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

Not sure if I even need the dnsmasq.conf file unless each ESP loging in will be assigned an IP while it's logged in.

I definitely need to change the Static ip_address=169.254.78.169 so all my sensors can log into MQTT
So it's down to; what to do with the dnsmasq.conf?

Thanks
That's the correct places,
The first five the PiZ its IP address
(So you can use 192.168.1.1 or 10.8.7.1 or whatever)
You then need to alter the range to the same
192.168.1.2,192.168.1.20 etc
If you have a lot of devices connect to it you may need to increase '20' to a higher value, say 100.
I don't know how many the ZeroW's wi-fi can handle at one go.

User avatar
marine_hm
Posts: 82
Joined: Tue Mar 07, 2017 4:27 pm

Re: Which operating system for Pi Zero W as access point, MQTT only

Fri Aug 17, 2018 2:34 am

Bensimmo;

I tried that, It didn't work. I probably had an unseen typo. Anyway. It was a bit more effort to change the IP address of all the sensors, but I did and all is back to working. I'm going to do some testing out doing a backup of the SD. Next time it happens I should just be able to pull out another pi Zero W, pop in a new sd with the image on it and be back in business. I had been planning for some time to do it. Now I NEED to!

Thanks to all that participated in his thread.

Return to “General discussion”