[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

That doesn’t sound normal at all. How do you have the 5v supply wired into the circuit?

I have a wall outlet 1amp?? 5V power supply hooked up to the vin on the ESP8266 then I have the PIR sensor plugged right into the same feed. I did put some 10K resistors on the magnetic contact sensors? wondering if I even need them…

I feel dumb. Checked and checked and checked - and I typed B instead of F, not once, but MULTIPLE times…

Working fine now.

1 Like

You should not need the 10K resistors since we are typically using the Internal Pullup Resistor feature of NodeMCU ESP8266 module. Which NodeMCU pins are you using for your magnetic contact and PIR sensors?

Alright I’ll take them out. I am using D1 and D2 for Contact, D5 and D6 for the relay control. D7 is controlling the pir.

Should the unused pins grounded?

Those are all very good pin choices, based on my research. You do NOT need to ground the unused pins. Doing so will actually cause problems during booting for some of the pins, which is why I do not recommend using them for magnetic contact sensors.

Thanks @ogiewon ,

Upon doing some more research and some testing using a single NodeMCU with Shift In Registers works, but with a catch. It is constantly running through each input checking them in series, for example it would start at 1, then go to 2, then 3, etc until the last and then it would do it again. So if I had all 24 connected it could take 12-24 seconds for the cycle to run then go back to the start of the loop. That is too much time in my mind for a contact to open and then close and never register with the system.

I’m now working on using a Mega with an ESP8266 unit. It should meet everything that I need. When I finish, I’ll post back on how it all came together. Thanks!

1 Like

I just ran into this same problem (again!) The MAC address must be in all caps–at least that was my problem.

New question (I didn’t see this one here). Looks like the ST_Anything firmware enables the WIFI AccessPoint…it’s an open AP with no security, and it hands out an ip address of 192.168.4.x. I couldn’t get anything to come up on that address, but i’d like to disable this. I see that the ESP2866 library previously had a bug that did this and I’m wondering if that’s being leveraged here?

Or is there another way to disable this? (or have I got my libraries setup wrong?)

I should add: THANKS SO MUCH FOR THIS FANTASTIC LIBRARY!!! I tried playing with the NodeMCU generally–using the LUA setup they use, and couldn’t even get it to do anything beyond echo’ing “hello world”…(lol) With this library I’m controlling a ceiling fan, and about to do several other projects.

David

1 Like

Grabbed it from the Mega file - perfect, thanks.

Yep, changed to DHT11 and worked a treat.

Is the default in Fahrenheit? how do I change it to Celsius please?

I spotted in the DTH the following line…

tiles(scale: 2) {
		multiAttributeTile(name: "temperature", type: "generic", width: 6, height: 4, canChangeIcon: true) {
			tileAttribute("device.temperature", key: "PRIMARY_CONTROL") {
				attributeState("temperature", label: '${currentValue}°', unit:"F", defaultState: true, 

Do I simply change the unit:“F” to a C?

TIA

@Vyker - You’re the second person this week to ask for Celsius readings from the DHT series of sensors.

I have added an optional Celsiuis argument to the PS_TemperatureHumidity (DHT) class constructor. Simply modify your sketch as shown below.

Note the last argument - if true the temperature reports in Celsius, otherwise Farenheit. If omitted, F is used as before.

  static st::PS_TemperatureHumidity sensor5(F("temphumid1"), 60, 40, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,"temperature1","humidity1", true);  //Celsius
  static st::PS_TemperatureHumidity sensor6(F("temphumid2"), 60, 50, PIN_TEMPERATUREHUMIDITY_2, st::PS_TemperatureHumidity::DHT22,"temperature2","humidity2", false); //Farenheit

Just download the new PS_TemperatureHumidity.h and .cpp files from my github repo and replace your current ones in your …\Documents\Arduino\libraries\ST_Anything_TemperatureHumidity\ folder. Then rebuild your sketch.

Here are the updated comments which describe the purpose of each of the arguments:

//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_TemperatureHumidity sensor2("temphumid1", 120, 7, PIN_TEMPERATUREHUMIDITY, st::PS_TemperatureHumidity::DHT22, "temperature1", "humidity1", false);
//
//			  st::PS_TemperatureHumidity() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- byte pin - REQUIRED - the Arduino Pin to be used as a digital output
//				- DHT_SENSOR DHTSensorType - REQUIRED - the type of DHT sensor (DHT11, DHT21, DHT22, DHT33, or DHT44)
//				- String strTemp - OPTIONAL - name of temperature sensor to send to ST Cloud (defaults to "temperature")
//				- String strHumid - OPTIONAL - name of humidity sensor to send to ST Cloud (defaults to "humidity")
//				- bool In_C - OPTIONAL - true = Report Celsius, false = Report Farenheit (Farentheit is the default)

You are going to also need to change your Child_Temperature Device Handler (ST IDE Groovy Code) to replace the “F” with a “C” to reflect the proper units.

1 Like

David,

Are you using the latest version of the ST_Anything and SmartThings libraries? I just ran a couple of tests using a standalone NodeMCU ESP8266 as well as an Arduino MEGA+ESP01 to see if the esp8266 Access Point was active in either one. I both cases I do not see a broadcasting AP.

This was an issue I noticed in an earlier release of my SmartThings communications libraries, but I believe I resolved it in a release many weeks ago.

Please note that during some extensive work on the SmartThings communications library, I was forced to break it up into multiple SmartThings library folders to prevent duplicate object linker errors. This is due to the fact that the various Ethernet and WiFi libraries implement the exact same object/function calls.

Be sure to remove your existing …\Arduino\libraries\SmartThings folder and replace it with all of the newer SmartThings folders from my GitHub repository. Do NOT just copy the new folders on top of the old one, as you will end up with duplicate files in multiple folders.

Dan

OK, Found my solution (posting in case it’s not just me…) Looks like my compiler is using version 2.3.0 of the ESP library (should be post bug I mentioned).
To fix this, I added a line to ST_Anything_Multiples_ESP8266WiFi.h at the end of the setup routine, right after the st::Everything::initDevices(); line as follows:
WiFi.mode(WIFI_STA);

I also tested and if you want the AP, add these 2 lines (for WPA2-PSK password):
WiFi.mode(WIFI_AP_STA);
WiFi.softAP(“yourAPssid”,“yourWPA2Password”);

either way, no more open AP for the neighbors to poke around at.

Thanks again!

Aren’t you just using the Arduino ESP8266 Board Manager Package via the Arduino IDE?

Here is how I added it, which I believe keeps everything up to date with the latest changes.

Yes, but I wasn’t sure how the wifi library was getting called in–I thought maybe it was part of your repository. I waded through the code and determined it was using the library tied to the hardware profile (and automatically updates, as you indicated). That’s where I found the wifi commands to disable the AP. Otherwise the AP was enabled by default with an SSID using the mac address, and no password.

Besides being a temptation for the neighbors, I plan on having 4-5 of these running…that’s way too many additional AP’s in the house clogging up wifi channels.

Thanks

So, I think I used to have the “WiFi.mode(WIFI_STA);” command at one time, but it looks like I may have lost that command during some rewriting of the libraries. My ESP8266’s must have preserved that setting in their NVRAM whic is why I don’t see the access points.

I will add it to my ToDo list for the ESP8266 libraries.

Thanks for the feedback!

Hi Dan, great work… truly amazing

There is a product, from Sparkfun,

From the description, Is this an ESP8266 product that could be used with your software?

Thanks

Ben

Ben,

It is possible that you could get that shield to work as a WiFi shield for an Arduino. Which Arduino would you consider pairing it up with? My support for using an ESP8266 as a WiFi Shield is pretty much limited to using it with an Arduino MEGA 2560 board due to the use of the extra high speed Hardware Serial UART to communicate between the two boards. The shield you linked above is designed to work with either pins 0/1 (not desirable since those are used to debug the Arduino) or pins 8/9. You would probably want to move the switch to use pins 8/9 and then add jumper wires from pins 8/9 to pins 18/19 on the MEGA.

You might also have to adjust the baud-rate of the ESP8266 on the SparkFun shield to use 115200 which is what my software expects (and is what most new ESP01 boards come set to by default.)

Finally, can I ask why you’re not just using a NodeMCU ESP8266 board to handle everything? The reason I ask is that the NodeMCU boards are by far the most reliable when it comes to WiFi network connectivity based on my testing. The Arduino + W5100/W5500 shield is also very reliable.

The Arduino + ESP01 or Arduino + WiFi101 combinations work, but seem to lose their WiFi connections randomly. I have spent a considerable amount of time trying to make these platforms robust, but there appears to be some root causes that elude me. I have added reconnect logic and retransmit logic to these combinations to try to make them as robust as possible. BTW - Even the Arduino MKR1000 (which uses WiFi101) is plagued by the same problems. I just want you to understand some of the issues you might face using WiFi connectivity.

The NodeMCU ESP8266-12e based boards are very inexpensive. If you need more IO than one can provide, you could simply just use an additional one. Of course, if you need a ton of I/O, it probably is not practical as compared to an Arduino MEGA 2560.

Hope this helps,

Dan

Hi Dan, Thankyou for your reply

The Arduino I am using is the Leonardo, so hardware serial is OK on pins 0
and 1

I have a customPCB that was designed for a specific project, using the Thing
Shield, my thought was to use a couple of these to finish the project.

I was able to purchase a couple of Thing Shield from Garnet, but nobody else
came forward to sell their obsolete units.

If this does not work, then a NodeMCU ESP8266 board, would have to be
adapted to replace the Leonardo based mother board

Probably requiring a new PCB design.

The easiest approach would be with an arduino uno form factor , the one
Sparkfun has, this will fit into the socket set on the custom motherboard I
have, and connect to the hardware Serial lines on the Leonardo.

My application reads, Temperature, Humidity, and CO2 levels ( all from I2C
sensors ), as well as actuating a single relay.

The three pieces of data are sent to Smarthings, with the relay being
activated momentarily, from a smart phone, if a restart is required.

So question is, does the Leonardo have enough memory for an ESP8266 shield.

The Leonardo system with the original Thing Shield uses 19,920 bytes out of
a max of 28,672, ( about 30% left )

and 1,215 bytes of dynamic memory out of a max of 2,560 bytes. ( about 53%
left )

Thanks again

Ben

Thank you for making this change, I can confirm it works. Very cool

I can confirm the open AP. I was able to connect to it and then scan the network. Probably not ideal.
I had a look at the .h file and couldnt find anything, then checked the ccp, also nothing in there. I found it in the .ino file.
Maybe a quick edit of your post to correct the file extension for others to correct?

Can also confirm adding the additional line removed the AP. Thanks :slight_smile: