Witty Cloud ESP8266 + Souliss

1,206 views
Skip to first unread message

Juan Luis

unread,
May 18, 2016, 12:09:12 PM5/18/16
to souliss
Hi all,

I don't know if this subject has been commented before, but it is a nice development board for souliss, ready to use. 

It include two boards:
On the top  the ESP8266 -12 + LDR + RGB LED + Button. 
On the bottom Usb converter.

Here a code example: 

/**************************************************************************
   Hello Souliss - World Witty Cloud 
    
    This is a basic example for control the RGB Led, the push button and the LDR
 
    using SoulissApp (get it from Play Store) you can control it from your mobile phone
    
    Load this code on ESP8266 board using the porting of the Arduino core
    for this platform.

    LDR measures displayed in SoulissApp are not in Lux, we would need a mapping table for calibrate in lux, not covered on this example
        
***************************************************************************/

// Let the IDE point to the Souliss framework
#include "SoulissFramework.h"

// Configure the framework
#include "bconf/MCU_ESP8266.h"              // Load the code directly on the ESP8266
#include "conf/Gateway.h"                   // The main node is the Gateway, we have just one node
#include "conf/IPBroadcast.h"

// **** Define the WiFi name and password ****
#define WIFICONF_INSKETCH
#define WiFi_SSID               "MyWifi"
#define WiFi_Password           "MyPassw"    

// Include framework code and libraries
#include <ESP8266WiFi.h>
#include <EEPROM.h>

/*** All configuration includes should be above this line ***/ 
#include "Souliss.h"

// This identify the number of the LED logic   
#define LEDCONTROL          0               // This is the memory slot for the logic that handle the light
#define LEDRED              1               // This is the memory slot for the logic that handle the light
#define LEDGREEN            2               // This is the memory slot for the logic that handle the light
#define LEDBLUE             3               // This is the memory slot for the logic that handle the light   
#define LDR                 4               //Memory slot for the logic that handle light sensor


//This define the pin numbers
#define pinRed 15
#define pinGreen 12
#define pinBlue 13
#define pinSw 4
#define pinLDR A0

void setup()
{   


  // **** Define here the right pin for your ESP module **** 
    pinMode(pinRed, OUTPUT);                 // Power the Red LED
    pinMode(pinGreen, OUTPUT);                 // Power the Green LED
    pinMode(pinBlue, OUTPUT);                 // Power the Blue LED  
     pinMode(pinSw, INPUT);                 // Input switch  
     pinMode(pinLDR, INPUT);                 // Photoresistence  

    Initialize();

    // Connect to the WiFi network and get an address from DHCP
    GetIPAddress();                           
    SetAsGateway(myvNet_dhcp);       // Set this node as gateway for SoulissApp  

    // This is the vNet address for this node, used to communicate with other
  // nodes in your Souliss network
    SetAddress(0xAB01, 0xFF00, 0x0000);
    SetAsPeerNode(0xAB02, 1);
  
              
    Set_LED_Strip(LEDCONTROL);          // Set a logic to control a LED strip

     Set_T54(LDR);                       //set a logic for LDR
}

void loop()
    // Here we start to play
    EXECUTEFAST() {                     
        UPDATEFAST();   
        
        FAST_50ms() {   // We process the logic and relevant input and output every 50 milliseconds

            DigIn(pinSw, Souliss_T1n_ToggleCmd, LEDCONTROL); 
                   
            Logic_LED_Strip(LEDCONTROL);
            

            // Use the output values to control the PWM
            analogWrite(pinRed, mOutput(LEDRED));
            analogWrite(pinGreen, mOutput(LEDGREEN));
            analogWrite(pinBlue, mOutput(LEDBLUE));

            DigOut(LEDCONTROL, Souliss_T1n_Coil,LEDCONTROL);

        } 

          FAST_2110ms()
        {
           Logic_T54(LDR);
        } 

         FAST_7110ms()
        { 
              float ldr_read = analogRead(A0);  //not a real lux measure only for test
              Souliss_ImportAnalog(memory_map, LDR, &ldr_read);
        }
              
        // Here we handle here the communication with Android
        FAST_GatewayComms();                                        
    }

Regards Juan Luis
 

Fulvio Spelta

unread,
May 18, 2016, 1:25:22 PM5/18/16
to souliss
+1 nice

Di Maio, Dario

unread,
May 18, 2016, 2:35:10 PM5/18/16
to sou...@googlegroups.com

Nice!

From Mobile.

Frerk Meyer

unread,
May 18, 2016, 4:06:04 PM5/18/16
to souliss
Hello Juan Luis,

Yes, I discovered these boards a month ago and bought 2 of them in China.
They haven't arrived yet, but I want to use them as souliss nodes.

They seem to be ideal as a starting point, but with some modifications.
My goal are off the grid sensor nodes on the basis od the ESP8266 but powered in batteries
as long as possible.

- the usb to serial converter is pluggable, excellent, no modification needed (as opposed to NodeMCU nodes
with integrated USB), just take it off if programmed

- possibly desolder led and ldr and use some other sensors instead like a reed switch as a window/door sensor.

- connect GPIO16 to reset pin for deep sleep, this is very important and the essenence of it all, see:
https://tzapu.com/minimalist-battery-powered-esp8266-wifi-temperature-logger/

- desolder the voltage regulator from 5v to 3,3V (the usb shield has its own voltage regulator I presume, have to check)

- instead connect to a step-up board with 3,3V output, see
https://www.sparkfun.com/products/10967
These will power the node even when 2 AA or AAA batteries only have little more than 1,0V left.

Although with so many modifications one could try to build it from start with a ESP8266, but then a breadboard
friendly PCB is missing and the pluggable USB connector. I'll see to it.

Can't wait to put my fingers on those little buggers.

Frerk Meyer

Frerk Meyer

unread,
May 19, 2016, 4:38:22 AM5/19/16
to souliss
One more thing I forgot to mention on the topic of deep sleep:

I want to apply those insights:
https://www.hackster.io/fablabeu/esp8266-thing-by-sparkfun-982bc6
to the witty board under souliss. At the end there are come hints about
how to accomplish deep sleep on trhe ESP8266.
I'm courious how this works with souliss.

Frerk

Juan Luis

unread,
May 19, 2016, 5:56:57 AM5/19/16
to souliss
I have not experience in souliss powered by batteries.
In normal mode an esp8266 powered by a 230v switching powered supply consums about 2w which is ok if you can plug it to a 230v line, but unafordable if you will power it by batteries
I look forward to your experiences
Regards Juan Luis

Frerk Meyer

unread,
May 20, 2016, 6:54:08 AM5/20/16
to souliss
Andreas Spiess reached 17 Day on a coin cell and 425 days on 2 AA batteries with the ESP8266:
https://www.youtube.com/watch?v=IYuYTfO6iOs

So it's possible.

Frerk
Message has been deleted

Juan Pinto

unread,
May 20, 2016, 1:34:28 PM5/20/16
to souliss
Will be interesting test this code on a Souliss node :P
 
Regards

Dario Cdj

unread,
May 23, 2016, 9:43:01 AM5/23/16
to souliss
It would be a dream to have a low power batteries esp node, but don't know how to deep sleep it in Arduino ide, in the video they use lua.... I'm ready to test if someone can give me the way....

Dario2

Domenico Carvetta

unread,
May 23, 2016, 9:46:30 AM5/23/16
to souliss
Dear's,
me too!
Maybe, Juan have an idea on how to make it ?

Juan Pinto

unread,
May 23, 2016, 11:02:59 AM5/23/16
to sou...@googlegroups.com
Sorry Domenico, I don't :(

Regards

--
You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/D8d90Rz5POw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/f9a15864-cfcc-4bd0-98b4-398284fd92e4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Frerk Meyer

unread,
May 24, 2016, 4:22:47 PM5/24/16
to souliss
Deep sleep is possible with the esp8266 with the arduino bootloader and code too:

https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/example-sketch-goodnight-thing-sleep-mode

To use the deep sleep mode you have to modify the hardware, see the article.
On the code side it it easy:

#include <ESP8266WiFi.h>
[..]
  // deepSleep time is defined in microseconds. Multiply
  // seconds by 1e6 
  ESP.deepSleep(sleepTimeS * 1000000);

The watchdog timer will send a signal to XDP output pin, which
triggers a reset if connected to the reset pin which in turn
triggers a total restart of your programm beginning again in setup().

More hardware modifications (cut all leds) are described here and will work even
when not using Lua:
https://www.hackster.io/fablabeu/esp8266-thing-by-sparkfun-982bc6

This is all theoretical wisdom since I don't have hardware yet (and won't have
much time at the moment to really play with it if it arrives due to private circumstances).

Frerk

Domenico Carvetta

unread,
Jul 13, 2016, 10:55:25 AM7/13/16
to souliss
Frerk,
have you any progress about this matter ?
If so, please share with us, thanks.


Frerk Meyer

unread,
Jul 13, 2016, 3:29:21 PM7/13/16
to sou...@googlegroups.com
Yes and no. I purchased the witty cloud boards on 26.4.2016
and I received them on 7.7.2016. They cost $3.20 each but it
took too long to get them. But it was my fault. I bought it
from a reseller. so my advice is, always buy from the original
manufacturer, which is Shenzhen CAIZHIXING Electronic Co., Ltd.
See
http://www.aliexpress.com/item/ESP8266-serial-WIFI-Witty-cloud-Development-Board-ESP-12F-module-MINI-nodemcu/32566502491.html?ws_ab_test=searchweb201556_10,searchweb201602_5_10037_10049_10017_405_404_407_406_10032_10040,searchweb201603_2&btsid=a770d31d-6d6a-4840-b20a-edecba70be37

Meanwhile someone in our family died, so I don't have any time to tinker
with souliss and witty boards for a minimum of 2 months.
I presume you will understand that I have other priorities right now.

What I managed to do until now:
The boards start a little preinstalled demo program as soon as connected
to micro-usb, which does
cycle the color of the three color leds. The LDR and the micro switch
are not tested by this. But I received both boards in good condition
and they worked.

Then I installed the Arduino IDE 1.6.8 and ESP8266 support via the
boardmanager. I managed to modify the blink demo to light the
three leds to random brightness as soon as I press the micro-switch
and load and execute this Arduino sketch on both boards.
I selected the WeMos D1 Mini Board since Witty is no option in the board
manager and it worked.

Then I have some cheap small breadboards from china. If you take the
upper half of the witty board it fits perfect onto the breadboard. But
there is no space left north and south of the pins. So I took a motor
saw and cut the breadboards in two halfs. Now I have lots of space
around the pins when I plug it into the two independent halfs.
Th demo sketch runs without the bottom half of the witty boards because
it is only needed for reprogramming.

The upper half board has a 5v o 3,3V regulator chip for the 5v coming in
from the micro-usb. If I want to power it from two AAA batteries this
chip has to go. But then I cannot reprogramm the ESP8266. This is a
problem I have to solve before low-power battery is feasible.
Possible solutions are the use of a 3,3V FDTI USB adapter like to the
Arduino Pro Mini or Over-the-Air (OTA) updates via WiFi.

Next milestone is loading and running a demo with the souliss lib/core used.

But don't expect much progress in the near future. I will keep you
updated. I want to publish my findings in a new blog which is in the
making. Only the content is missing til now. There I'll be able to
illustrate some howtos with images or even video.

I would be pleased to know if anyone else tries something with these
witty boards.

Yours sincerely,

Frerk Meyer


Domenico Carvetta

unread,
Jul 15, 2016, 8:31:35 AM7/15/16
to souliss
Dear Frerk, no problem!
If you have time, pls follow us.
We are playing with other boards like yours; if you need some other details pls feel free to ask further.
BTW, I am experiencing about the function <ESP.deepSleep> you posted since few weeks ago; I will post you about the progress.
Thanks!!


Frerk Meyer

unread,
Jul 16, 2016, 3:55:08 AM7/16/16
to sou...@googlegroups.com
Hello Domenico,

from what I read one has to connect the GPIO16 pin (D0,XPD) to the reset
pin (RST). This is easily done on the Witty board because both are
connected to external pins and therefore the breadboard.
If you put the ESP8266 in deep sleep, only the RTC is powered an
triggers a reset after the time has elapsed. Therefore the whole
code has to be written in the setup() routine (Arduino) and not in the
loop() part, because it never reaches the loop() part. Last statement in
the setup() is the ESP.deepSleep(sometime)call.

BUT:
The connection has to be disconnected while reprogramming. Because
1. you can only program a ESP8266 while not being in deep sleep and 2.
after reprogramming the software uses a reset to start the program. So
it has to change the level on the RST pin.
Some people write that if you use a 1k resistor to connect GPIO16 to RST
instead of a wire, you never have to disconnect them. It is enough to
put the ESP into deep sleep but the usb connection is able to pull the
RST nevertheless.

No this is all theory and I have to find the time to check it in
reality. But perhaps this information is enough to help other people.

Yours sincerely,

Frerk

Am 15.07.2016 um 14:31 schrieb Domenico Carvetta:
> Dear Frerk, no problem!
..

Domenico Carvetta

unread,
Jul 16, 2016, 6:59:56 AM7/16/16
to souliss
Dear Frerk,
first, thanks for your reply; it's very interesting to learn by you.

Back to the main topic.....

1) About the connections, it's clear in any case, we must connect the GPIO16 (also called XPD) to the reset pin (also called DTR).
I want to use a ESP201 to trial run, and both pins have been exposed, fine.

2) I am not sure, pls double confirm it, that the whole code has to be written in the void setup () and not in the void loop() part.
I found an example where the code has been reported in the void loop(); pls see here and let me know what you think about it  : http://greppipelinux.synology.me/?p=535

Domenico




Frerk Meyer

unread,
Jul 17, 2016, 7:32:11 AM7/17/16
to sou...@googlegroups.com
Am 16.07.2016 um 12:59 schrieb Domenico Carvetta:
>..
> 2) I am not sure, pls double confirm it, that the whole code has to be
> written in the void setup () and not in the void loop() part.
> I found an example where the code has been reported in the void loop();
> pls see here and let me know what you think about it
> : http://greppipelinux.synology.me/?p=535

After poweron or reset the arduino bootloader code goes one time through
setup() and forever through loop(), but:
After ESP.deepsleep() there will be a reset!
So the code in loop() will be executed only once. After the reset code
execution will go through setup() again and all values from loop()
including a wifi connection are lost.

Therefore technically it doesn't matter if you put your code in setup()
or loop() as long as you realize that it will only executed once after
each timeout/reset and then begin anew.

So you have for example to setup the wifi connection after every
deepsleep period. And since the wifi part is the most power hungry and
DHCP protocol takes some time and lots of sending and receiving it is
more power-saving to work with a static IP.

Logically I would place the whole code into setup() to remind me and
others that it is only run once after each wakeup.

Furthermore I read on different places in the web that people have
problems reading data from DHT22 sensors after deep sleep. But the
1-Wire Dallas sensor DS1820 does work even after deep sleep. So if you
have the some problem perhaps you should try the other one.

Yours sincerely,

Frerk


Domenico Carvetta

unread,
Jul 17, 2016, 12:45:08 PM7/17/16
to souliss
Dear Frerk, first, thanks for yr answer.
I hope I got your clear explanation.
I will try to place the whole code just after the i.e. dht11 value reading into my sketch and will see if it works.
Best regards, domenico

Dario Cdj

unread,
Jul 18, 2016, 7:03:54 AM7/18/16
to souliss
If battery work for a reasonable period we can build low power door/window/temp sensor with wifi!

I will test it on september...

Dario2

Domenico Carvetta

unread,
Jul 18, 2016, 7:20:08 AM7/18/16
to souliss
I will try immy, and let you know asap.

Domenico Carvetta

unread,
Jul 21, 2016, 7:08:33 AM7/21/16
to souliss
Dear Frerk,
all things seems to be working fine, but the consumption of corrent it is not as expected.
From my opinion it seems to much: more or less 7-8mA in DeepSleep mode; however, during the WiFi connection it is in the range 80-100mA, that's in line as expected.
Am I wrong, perphaps?



Frerk Meyer

unread,
Jul 24, 2016, 12:29:31 PM7/24/16
to sou...@googlegroups.com
Am 21.07.2016 um 13:08 schrieb Domenico Carvetta:
> Dear Frerk,
> all things seems to be working fine, but the consumption of corrent it
> *is not as expected.*
> From my opinion it seems to much: more or less 7-8mA in DeepSleep mode;
> however, during the WiFi connection it is in the range 80-100mA, that's
> in line as expected.
> See also here to double confirm as
> above: https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/example-sketch-goodnight-thing-sleep-mode.
> Am I wrong, perphaps?

Hi Domenico,

See
https://www.hackster.io/fablabeu/esp8266-thing-by-sparkfun-982bc6

There it says:

"Marker (2) is after setting deep sleep mode: avg. 7,8 mA. Peak is 383
mA as of WiFi boost.

Why is the current still high? that is caused mainly by the status LEDs.
We are going to disable both LED (charging and power on) in the next step.

The new deep sleep current consumption is 88 uA ! That is cool for now ;-)
"

Check:
- Do you have any LEDs active?
- Do you operate on 3,3V?
- Is there still a voltage regulator active from 5V to 3,3V (which draws
current too)?

In the mentioned online how to there is a good link list at the end
which mentions your URL / Article too.

HTH,

Frerk

Domenico Carvetta

unread,
Jul 24, 2016, 1:40:02 PM7/24/16
to souliss
Dear Frerk,
I try to answer yr questions about the ckecklist:

- Do you have any LEDs active? Absolutely no. 
- Do you operate on 3,3V? I operate using 3xAA battery and the total voltage is around 3.9V.
- Is there still a voltage regulator active from 5V to 3,3V (which draws current too)? Absolutely no. 
I don't know why after deep sleep mode the avg. I measure still remaing around 8 mA !!!

My board is composed by only ESP201 (w/o any power led) + DHT11; that's all.
Thanks a lot!

Di Maio, Dario

unread,
Jul 24, 2016, 4:40:51 PM7/24/16
to sou...@googlegroups.com

Likely is the DHT consumption your problem, you need to cut the power to the sensor with a mosfet.

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.

To post to this group, send email to sou...@googlegroups.com.

Domenico Carvetta

unread,
Jul 25, 2016, 6:08:33 AM7/25/16
to souliss
Thanks for yr answer Dario, but I am sorry, I don't think so.
The DHT11 is consuming around maximum 1mA (nominal :vdd=5V, 25C); I tried to disconnect it from the board and the result seems the same like before.
Unfortunately, I am very far than 77uA as many blogs stated !!




Frerk Meyer

unread,
Aug 15, 2016, 4:14:30 AM8/15/16
to sou...@googlegroups.com
Hello Domenico,

Two ideas I got pondering over this (only theoretical, sorry):
1) Are there differences running different versions of the ESP8266?
The Witty cloud uses a ESP12-F. I couldn't find out what the Sparkfun
Thing uses.
2) The article about low power with the Sparkfun thing uses LUA, whereas
I start with the Arduino compatible INO skeptches, perhaps they differ
in how good/bad the deep sleep is implemented?

Hope it helps,

Frerk
> --
> You received this message because you are subscribed to the Google
> Groups "souliss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to souliss+u...@googlegroups.com
> <mailto:souliss+u...@googlegroups.com>.
> To post to this group, send email to sou...@googlegroups.com
> <mailto:sou...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/souliss/637f2903-db22-4761-aeff-3b1aa3349cf2%40googlegroups.com
> <https://groups.google.com/d/msgid/souliss/637f2903-db22-4761-aeff-3b1aa3349cf2%40googlegroups.com?utm_medium=email&utm_source=footer>.

domenico carvetta

unread,
Aug 15, 2016, 9:38:10 AM8/15/16
to souliss

Frerk, I think the first hypothesis could be the good one. I tried only the Esp201 but I am going to run a esp12f. I hope that is work fine.

Frerk Meyer

unread,
Aug 18, 2016, 3:01:12 AM8/18/16
to souliss
Hello Domenico,

I found another article about ESP8266 deep sleep modes with measured power consumption:

https://www.sparkfun.com/news/1842

HTH,

Frerk

Domenico Carvetta

unread,
Aug 20, 2016, 3:02:00 AM8/20/16
to souliss
I see, thanks !!


Domenico Carvetta

unread,
Aug 25, 2016, 12:25:18 PM8/25/16
to souliss
Good news!
The first hypothesis was the right one, I mean. 
I run the ESP12F and finally it works fine.
Attached the related pictures during WiFi connection and after during the DeepSleep(..).
Thanks a lot !!

20160825_173747.jpg
20160825_173802.jpg

Frerk Meyer

unread,
Sep 6, 2016, 7:50:15 AM9/6/16
to souliss
Good to hear it worked at last.

Today I came over a nice howto of deep sleep with an esp8266 on github:

https://github.com/z2amiller/sensorboard/blob/master/PowerSaving.md

There are several sensors and linear power regulators mentioned which do fine
for low power /battery applications.

Domenico Carvetta

unread,
Sep 6, 2016, 8:29:29 AM9/6/16
to souliss
Oh finally happy to hear You!
Yehh,, I will read your URL as soon and let you know.
Thanks!


Juan Pinto

unread,
Sep 6, 2016, 9:57:26 AM9/6/16
to sou...@googlegroups.com
Thank you so much Frerk, this info will be very useful :P



--
You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/D8d90Rz5POw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+unsubscribe@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/d85ad636-974b-4162-8511-f4c67eb9f16a%40googlegroups.com.

g.bonanno

unread,
Sep 7, 2016, 3:52:14 AM9/7/16
to souliss
Thanks
Very goog info !!! 

Domenico Carvetta

unread,
Sep 7, 2016, 4:55:26 AM9/7/16
to souliss
I re-started my experiments with ESP-12D.

It works ok so far; it pushes temp&hum data on the ThinkSpeak every half hour and consumes around 75-85uA during DeepSleep, remaining time 70-80mA average.
DHT11 consumes about 0.98mA all the time.
I started experiment since aug 31th with 3xAA batteries.
All seems ok so far !!

Reply all
Reply to author
Forward
0 new messages