User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Fri Oct 12, 2018 5:39 am

tlfong01 wrote:
Thu Sep 06, 2018 7:29 am
Wow, my tiny pump is only 800L/hr, so it is 20000 / 800 == 25 times smaller than your huge pump!
My tiny pump does have a huge neighbour though, a huge 28 floor building elevator motor switching on/off 24/7, generating electromagnetic interferences (EMI) which I suspect make my 4 floors below AM radio receiver intermittently noisy. I think it will also make any nearby MCP23017 crazy. So I guess I need to check from time to time if the MCP23017 at the rooftop garden has become dead and reset it again.

Raspberry Pi Smart Garden System Prototype - SwitchDoc Labs

SwitchDoc Labs' smart garden looks interesting. It has ESP8266 compatible blynk
https://www.blynk.cc/
http://docs.blynk.cc/
https://www.youtube.com/watch?v=FhS44hGk1Lc
https://github.com/blynkkk/blynk-librar ... emcu-setup


Appendix - Raspberry Pi Smart Garden System Prototype - SwitchDoc Labs
https://www.youtube.com/watch?v=etwn5AwXLPw
https://www.kickstarter.com/projects/su ... ts/2312674
https://github.com/switchdoclabs/SDL_Pi ... rdenSystem

SGS - A Raspberry Pi based smart watering system kit for Makers, advanced kids and adults. Learn while you grow! No soldering needed!
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Fri Oct 12, 2018 1:22 pm

tlfong01 wrote:
Tue Oct 09, 2018 1:49 pm
tlfong01 wrote:
Sun Oct 07, 2018 8:59 am
The D1 Mini Pro now has 16MBon board

WeMos D1 Mini and D1 Mini Pro Testing Notes

Both D1 Mini and D1 Mini Pro are tested OK.

WeMos D1 Mini and D1 Mini Pro Testing Notes

Now I am testing the purple board version.

Code: Select all

*** WeMOS D1 Mini test record 2018oct12hkt2108 ***

1. *** esptool chip_id ***

PS C:\WINDOWS\system32> esptool chip_id
esptool.py v2.5.1
Found 1 serial ports
Serial port COM21
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 84:f3:eb:a9:ee:e6
Uploading stub...
Running stub...
Stub running...
Chip ID: 0x00a9eee6
Hard resetting via RTS pin...
PS C:\WINDOWS\system32>

2. *** esptool erase_flash***

PS C:\WINDOWS\system32> esptool erase_flash
esptool.py v2.5.1
Found 1 serial ports
Serial port COM21
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 84:f3:eb:a9:ee:e6
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 10.3s
Hard resetting via RTS pin...
PS C:\WINDOWS\system32>

3. *** cd d:\work\rpi_forum\nodemcu\nodemcu_firmware *** 

PS C:\WINDOWS\system32> cd d:\work\rpi_forum\nodemcu\nodemcu_firmware


4. *** esptool --port=COM21 write_flash ... ***

PS D:\work\rpi_forum\nodemcu\nodemcu_firmware> esptool --port=COM21 write_flash -fm=dio -fs=4MB 0x00000 nodemcu-master-9-modules-2018-09-21-08-05-08-float.bin
esptool.py v2.5.1
Serial port COM21
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 84:f3:eb:a9:ee:e6
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x0240
Compressed 589824 bytes to 358361...
Wrote 589824 bytes (358361 compressed) at 0x00000000 in 31.6 seconds (effective 149.4 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
PS D:\work\rpi_forum\nodemcu\nodemcu_firmware>

5. ESPlorer IDE connect

NodeMCU custom build by frightanic.com
	branch: master
	commit: 3661b8d5eb5b42ed2d5ff51fa8e9628c17270973
	SSL: false
	modules: file,gpio,i2c,net,node,spi,tmr,uart,wifi

 build created on 2018-09-21 08:04
powered by Lua 5.1.4 on SDK 2.2.1(6ab97e9)
lua: cannot open init.lua
> Heap size:42992.

 EVENT_DBG(wifi_event_monitor_handle_event_cb): was called (Event:7)

 EVENT_DBG(wifi_event_monitor_handle_event_cb): was called (Event:7)

6. *** test blink program blinky2018oct1121.lua ***

-- *** Blinky2018oct1120 tlfong01 2018oct11hkt1527 *** --

-- *** Contents *** --

--   References
--   Configuration
--   Function definitions
--   Main

-- *** References ***

-- References 
-- https://nodemcu.readthedocs.io/en/master/en/modules/tmr/ (tmr)
-- https://github.com/nodemcu/nodemcu-firmware (NodeMcu v2.2.1)
-- https://nodemcu.readthedocs.io/en/master/
-- https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples
-- https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples/mcp23008
-- http://www.electronicwings.com/nodemcu/nodemcu-gpio-with-esplorer-ide (with blinky example)
-- https://dev.minetest.net/Lua_code_style_guidelines

-- *** Configuration *** --

-- ** Print titles ***

-- *** Functions *** --

-- ** Print Functions ***

function printProgramTitle(programTitle)
  local threeStars = '***'
  local fourNewLines = '\n\n\n\n'
  print(fourNewLines, threeStars, 'Begin program =', programTitle, threeStars, fourNewLines, fourNewLines)
  return
end

-- ** GPIO Functions ***

function setPinOutput(pinNum)
  gpio.mode(pinNum, gpio.OUTPUT)  
  return
end

function setPinHigh(pinNum)
  gpio.write(pinNum, gpio.HIGH)  
  return
end

function setPinLow(pinNum)
  gpio.write(pinNum, gpio.LOW)  
  return
end

function setPinLevel(pinNum, pinLevel)
  local High = true
  local Low  = false
  if pinLevel == High
    then
      setPinHigh(pinNum)
    else
      setPinLow(pinNum)
  end
end

-- *** Timer Functions ***
function stopTimer(timerNum)
  tmr.stop(timerNum)
end

-- ** Toggle Pin Function ***

function togglePin(pinNum, toggleTime)
  setPinOutput(pinNum)
  local High = true
  local Low  = false
  pinLevel = High

  tmr.alarm(
    1,toggleTime,1,function()

    if pinLevel == High then
        pinLevel = Low
        setPinLevel(pinNum, pinLevel)
    else
        pinLevel = High
	setPinLevel(pinNum, pinLevel)
    end

  end
  )
return
end

function main()
  
  programTitle = 'blink2018oct1127'
  printProgramTitle(programTitle)
  
  timerNum = 1
  pinNum = 4
  toggleTime = 100
  
  togglePin(pinNum, toggleTime)
  return
end  

--- *** Main *** --

main()

.END
Attachments
d1_mini_test_2018oct1201.jpg
d1_mini_test_2018oct1201.jpg (174.39 KiB) Viewed 305 times
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Fri Oct 12, 2018 2:07 pm

tlfong01 wrote:
Mon Oct 01, 2018 4:45 am
tlfong01 wrote:
Sun Sep 30, 2018 6:16 am
Flashing and Wifi Connection Reliability
But when I googled about Esp8266 wireless things earlier, I found guys talking about noise problems and unreliable connections. So earlier when I find one TabBao shop selling their USB to TTL cable, boasting that their cable is very good, because they are using the very reliable CH340 chip, and that they use a very big 1000uF to by pass the noise, I got somewhat brainwashed and ordered their high class, highly reliable 9 yuan cable. Their ad even said their cable is HGT (High, Great, and Trendy), so you will lose face using old things like FTDI.
My fake FTDI USB to TTL cable
I have an old USB to TTL adapter cable, using the PL2302HX chip. The USB end of the adapter marked "FTDI 232". I am not sure if this means my cable is a fake FTDI cable. Anyway, I found the TTL end has two Vcc pads, one marked 5V, the other 3V3 which is not connected. I guess I need to use 3V3 signals for ESP8266. So I am going to shift the wire from 5V0 to 3V3.

ESP8266 Upload Problem - Testing PL2302HX USB to TTL Cable

Now I am coming back to test the reliability of the PL2302HX USB to TTL cable. I have been using a plain USB cable to test the NodeMCU board with CH340 USB to TTL on board and so far so good, no upload problem at all, whether using esptool.py or ESPlorer.

Now if the external PL2302HX cable has any problem, then it is likely that it is the external USB to TTL cable causing trouble.
Attachments
pl2302hx_usbttl_test_2018oct1201.jpg
pl2302hx_usbttl_test_2018oct1201.jpg (184.57 KiB) Viewed 298 times
I am an electronics, smart phone, and smart home hobbyist.

Brandon92
Posts: 473
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: GPIO.input voltage levels vs edge detection

Fri Oct 12, 2018 2:59 pm

petermeigs wrote:
Wed Oct 10, 2018 7:09 am
I thought I would share my progress with my 16-channel device to read the which of 24vac lines are on. I only have one column of 4 A3700's wired and even then not 100%.
You can see where I'll put the mcp23017. Thank you, forum buddies, for the suggestion to use this chip.

You see a mini-usb connector for power and I'll use a LD1117 to drop a 5vdc power supply (I have many of these left over from old phones and other devices) to 3.3v. I expect that the 800ma mentioned in the datasheet for output will be plenty and I don't risk my rpi's 3.3 volt max. I see that a LM3940 has been mentioned in this forum. This application note http://41j.com/blog/wp-content/uploads/ ... onNote.pdf lead me to use the LD1117 but if someone has a good reason to choose one over the other, I'd love to know.

The green screw blocks will connect with 16 valve solenoids and there will be two common screw blocks. I have not tested with actual solenoids yet so I'm a little worried about the effect of the coil when the power is shut off to the solenoids by the sprinkler controller. I'm hoping that since it is 24vac, it will not cause the issues a dc coil would.
First about the solenoid.
Well, the solenoid is still a coil. And will produce the same result in ac as in dc, if the power is turned off. But I also don't know how the internal of that solenoid is made. So, you could protect your circuit by a fuse* and a bidirectional tvs diode. The tvs diode will clamp the voltage to a save level. And if the spike is to long, the fuse will blow.

*a other possibility is to use a ptc fuse. This will reset itself.

About the voltage regulator. Well it depants on your needs and the cost. And for the basic operation. Both will do the job just fine.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sat Oct 13, 2018 3:22 am

petermeigs wrote:
Sat Sep 29, 2018 5:03 pm
Some esp8266 tips:
... Be careful of which gpio pins you use. At power-on, some of the pins change value cycling between on and off until they get to their startup state.: See http://rabbithole.wwwdotorg.org/2017/03 ... -gpio.html [Stephen Warren]
Stephen Warren
http://www.wwwdotorg.org/cv.html
4 year M.Eng. in Computer Science at Imperial College, London, UK. Completed in June 1997.
Awarded a first-class MEng Honours degree
Awarded the governors' prize for the best overall student.

Tips on using ESP8266 GPIO

Thanks for your advice on using GPIOs. This reminds me of your another suggestion to erase flash before flashing firmware. I did' take it seriously, because my arduino common sense tells me it is nonsense or waste of time erasing something before overwriting. It was only I found weird things happening, then I began to suspect that erasing flash first is a MUST!

One reason that I still have not finished my very first Lua blinky is that I wish to plan ahead and think great on how to blink all the GPIO pins one by one in sequence, and also not using tmr.alarm with the ugly lamda thing, but diy my own callback outside the tmr.register function.

I also found ESPlorer behaviour weird. I now suspect that ESPlorer has some sort of memory, and would punish my bad code together with latter good code for generations.

So I agree with Matthrew Ford in powering up/down and 'let things cool down' instead of manual/software reset ESP8226.

Appendix Using GPIO pins

Using ESP8266 GPIO0/GPIO2/GPIO15 pins - Matthew Ford
https://www.forward.com.au/pfod/ESP8266 ... index.html

How to use GPIO0, GPIO2 and GPIO15 pins as Outputs and Inputs on ESP8266 modules

All modules make GPIO0 and GPIO2 accessible. Most modules, other than ESP8266-01, also make GPIO15 accessible. These GPIO's control how the module starts up and as such require special handling if they are to be used at all. GPIO6-GPIO11 also require special treatment as described below

When programming ESP8266 .. get ... error: espcomm_upload_mem failed

1. In that case follow these steps to get it working:-

2. ... 3. ...

4. Power cycle the ESP8266 with GPIO0 grounded, ...

If 3) does not fix it, unplug the USB cable from the computer wait few secs and plug it back in

If 4) does not fix it, uplug USB cable from PC, close Arduino IDE, open Arduino IDE, plug USB cable back in.

When you apply power to the ESP8266, after grounding GPIO0, make sure it is applied cleanly. Don't jiggle the connection. The ESP8266 led should just come on and stay on without any flashes.

Flash GPIO pins – GPIO6 to GPIO11

Most ESP8266 boards have a flash chip connected to some or all of GPIO6-GPIO11. Most programs use flash memory, as well as RAM, so unless you specifically make sure your code only runs from RAM, you can't use these pins for other purposes.

The exact number of pins used in the range GPIO6 to GPIO11 depends on the type of flash hardware used on your module.

Quad IO uses 4 lines for data (6 pins total) for up to 4 times the speed of standard.

Dual IO uses 2 lines for data (4 pins total) Standard uses a single line for data (3 pins total).

Unless you know exactly what your board requires, you are best to just ignore GPIO6 to GPIO11 and do not refer to them from your code.

GPIO0, GPIO2 and GPIO15 pins

These pins determine what mode the chip starts up in.

For normal program execution GPIO0 and GPIO2 need to be pulled up to Vcc (3.3V) and GPIO15 needs to be pulled to GND, each with a resistor in the range 2K to 10K resistor. A 2K resistor gives better noise immunity. OLIMEX uses 2K resistors SparkFun uses 10K resistors. I use 3K3 resistors.

The settings of these inputs is only checked during the power up (or reset) of the chip. After that the pins are available for general use, but as discussed below their use is restricted by these external pull up/down resistors.

Using GPIO0, GPIO2 and GPIO15 as Outputs

As noted above, these pins will already have a resistor connected to either VCC (GPIO0 and GPIO2) or GND for GPIO15. This determines how any external device, like a relay or led+resistor, must be connected.

For GPIO0 and GPIO2, an external relay must be connected between VCC and the pin so that it does not interfere with the action of the pull up resistor.

Conversely an external relay connected to GPIO15 must be connected between GND and the pin so that is does not interfere with the action of the pull down resistor.

To activate the external device, GPIO0 or GPIO2 must be driven LOW (Active LOW) while GPIO15 must be driven HIGH (Active HIGH).

The schematic below shows how to use GPIO0 and GPIO2 and GPIO15 as outputs. This circuit includes the necessary pullup/pulldown resistors as well. Note the 5V relay module driven by GPIO0 is opto-isolated and has a separate common connection for the input. It is important that the 5V VCCA voltage is not applied to the ESP8266 pin.

How to reprogram when using GPIO0 as an output

Note: GPIO0 is needs to be grounded to get into programming mode. If you sketch is driving it high, grounding it can damage you ESP8266 chip.

The safe way to reprogram the ESP8266 when your code drives the GPIO0 output is to :-

a) Power down the board

b) short GPIO0 to gnd

c) power up the board which goes into program mode due to the short on GPIO0

d) remove the short from GPIO0 so you don't short out the output when the program runs


e) reprogram the board

f) power cycle the board if necessary.

Using GPIO0, GPIO2 and GPIO15 as Inputs.

Using these pins as inputs is a bit tricky.

As noted above on power up, and during reset, these pins must be pulled up or down as required to have the ESP8266 module start up in normal running mode.

This means, in general, you cannot just attach an external switch to the these pins because at power up you usually cannot guarantee the switch will not be pulling the input to ground and so prevent the module from starting correctly.

The trick is to not connect the external switch directly from the GPIO0 or GPIO2 to GND but to connect it instead to another GPIO pin which is driven to ground (as an output) only after the ESP8266 starts up.

Remember, when used as outputs, the GPIO pins provide a very low resistance connection to either VCC or GND depending on whether they are driven HIGH or LOW.

Here only GPIO0 and GPIO2 will be considered. Using this method you can get one (1) addition input using these two (2) GPIO's.

A similar method can be used for GPIO15 by using another GPIO pin to connect its switch to +VCC, but this does not gain an extra input, you might as well just use the other GPIO pin directly as an input.

The circuit below uses the ESP8266-01 module as an example. Without using this trick, the ESP8266-01 does not have any free pins to use as an input if you are already using pins RX/TX for a UART connection.

Since the sketch's setup() method is only run after the ESP8266 module starts up, it is safe to make GPIO0 output LOW then and so provide a ground for S1 connected to GPIO2. You can then use digitalRead(2) elsewhere in your sketch to read the switch setting.


Matthew Ford - Forward Computing and Control
https://www.forward.com.au/profile/profile.html
Specialises in Java programming, modelling, simulation, numerical software algorithms, control system design and GAUSS programming.
Dr Matthew Ford (Bsc. BE. Ph.D.) is the Director and Principal Consultant and has over 30 years experience in programming, engineering and control systems.
Forward Computing and Control has completed the following projects, ..
.
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sat Oct 13, 2018 5:50 am

Brandon92 wrote:
Fri Oct 12, 2018 2:59 pm
petermeigs wrote:
Wed Oct 10, 2018 7:09 am
... mini-usb connector for power
... LD1117 to drop a 5vdc power to 3.3v.
So, you could protect your circuit by a fuse* and a bidirectional tvs diode. The tvs diode will clamp the voltage to a save level. And if the spike is to long, the fuse will blow.
a other possibility is to use a ptc fuse. This will reset itself.

Fuses and Varisters

I have been using the following fuses and varisters in my projects.

Auto reset fuse 0.5A 72V RXEF050 ¥0.12
https://detail.tmall.com/item.htm?id=52 ... 3ad4zgJTDZ

Auto reset fuse 0.12A 120MA 250V x 10 ¥1.70
https://detail.tmall.com/item.htm?id=52 ... 3ad4zgJTDZ

Fast blow fuse 3*10MM 1A 250V x 10 ¥1
https://detail.tmall.com/item.htm?id=40 ... 3ad4zgJTDZ

Fast blow fuse 3*10MM 2A 250V x 10 ¥1
https://detail.tmall.com/item.htm?id=40 ... 3ad4zgJTDZ

Fast blow fuse 3*10MM 5A 250V x 10 ¥1
https://detail.tmall.com/item.htm?id=40 ... 3ad4zgJTDZ

Metal Oxide Varister 14D471K 14D391K 14D561K 14D821K 14D681K 14MM x5 ¥1.64-2.68
https://detail.tmall.com/item.htm?id=56 ... 3ad4zgJTDZ
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sat Oct 13, 2018 12:41 pm

tlfong01 wrote:
Fri Oct 12, 2018 2:07 pm
tlfong01 wrote:
Mon Oct 01, 2018 4:45 am
ESP8266 Upload Problem - Testing PL2302HX USB to TTL Cable
Now I am coming back to test the reliability of the PL2302HX USB to TTL cable. I have been using a plain USB cable to test the NodeMCU board with CH340 USB to TTL on board and so far so good, no upload problem at all, whether using esptool.py or ESPlorer.
Now if the external PL2302HX cable has any problem, then it is likely that it is the external USB to TTL cable causing trouble.

Testing ESP8266-01 Board Using USB to TTL cable

I found one problem when trying to flash NodeMCU ESP8266-12 board using the external USB to TTL cable. I found that I cannot set GPIO0 to ground to set the flash mode. The reason is that the built in USB to TTL circuit controls the GPIO0 and therefore cannot be set by external manual signal. In other words, I can use external USB to TTL cable for ESPlorer program testing, but not for uploading firmware.

So I decided to try ESP8266-01 board which has no built in USB to TTL converter.

Appendix - ESP8266-01 References

ESP8266 WIFI MODULE FOR DUMMIES - TonesB

https://www.instructables.com/id/ESP826 ... r-Dummies/

The ESP8266 was launched in 2014 and is rapidly growing in popularity. There is only one ESP8266 processor but it is found on many different breakout boards. These all differ in terms of which pins are exposed and the size of the flash memory etc.

These breakout boards have evolved rapidly over the years and there is a lot of information to be found on the web.

This is both a blessing and a curse as some of the advice is outdated or just plain wrong.


As a result it took me 3 days before I could get it to do anything! Some people are lucky but for me it was a battle to get anything working. At times I thought I had broken it but with some perseverance it always came back to life!

NB: The quality of the power supply to the ESP is one of the most important factors. There is a small capacitor (.1uF) across 3.3V and Ground to minimise spikes. If you are having problems with programming your ESP it may well be your power supply. What will help is to add another larger capacitor across 3.3V and Ground. eg: 10uF.

The RESET pin is held high with a 10k ohm resistor and brought to ground by the RESET button which will reboot the chip. Press RESET every time before you upload code, and every time you connect or disconnect GPIO 0. The reset button will save you a lot of hassle.

When you power the circuit up the red LED on the ESP-01 should light up and the blue LED should flash briefly. Later when uploading code to the ESP the blue LED should flash continuously during the process. Any other LED combinations suggests that there is a problem.

NB: If you want to remove the Serial programmer and run the ESP on its own, make sure you disconnect GPIO 0 from ground and push the RESET button otherwise the ESP may not work properly.

The 3.3V Vout on the Arduino is insufficient to drive your ESP8266 and you could get unreliable results. Preferably use another 3.3V supply.

As a recommended practice always upload a blank sketch to your Arduino before connecting any other devices to avoid any unpredictable results. A blank sketch has empty setup() and loop() functions.


ESP-01 WiFi Module V1.0 - Shenzhen Anxinke Technology - AI-Thinker
https://ecksteinimg.de/Datasheet/Ai-thi ... 1%20EN.pdf

HOW TO USE THE ESP8266-01 PINS AND LEDS - drmpf
https://www.instructables.com/id/How-to ... 6-01-pins/
Attachments
esp8166-01_2018oct1301.jpg
esp8166-01_2018oct1301.jpg (178.33 KiB) Viewed 248 times
Last edited by tlfong01 on Sat Oct 13, 2018 1:31 pm, edited 2 times in total.
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sat Oct 13, 2018 1:25 pm

tlfong01 wrote:
Sat Oct 13, 2018 12:41 pm
Testing ESP8266-01 Board Using USB to TTL cable
I found one problem when trying to flash NodeMCU ESP8266-12 board using the external USB to TTL cable. I found that I cannot set GPIO0 to ground to set the flash mode. The reason is that the built in USB to TTL circuit controls the GPIO0 and therefore cannot be set by external manual signal. In other words, I can use external USB to TTL cable for ESPlorer program testing, but not for uploading firmware.

So I decided to try ESP8266-01 board which has no built in USB to TTL converter.

ESP8266-01 Test Results

I found no problem flashing the nodemcu firmware, and using ESPlorer to run the Hello World program.

However, there is one annoying thing, I need to power cycle or manual reset the board for each step of the chip_id, erase_flash, and write_flash operation.

This is reset/power cycle for every esptool command is a waste of time. Another sad thing is that my old blink led program does not work, perhaps the blue led connected to Tx cannot be controlled by a Lua program. I could not google to find which GPIO is connecting the blue LED (GPIO 1 for Tx?).

Anyway, I found ESP-01 (using external CH340G USB to TTL cable) disappointing. So I gave up and go back to play with the ESP12 NodeMCU board, carry on writing my first Lua program - blinky. I googled and found a guy also complaining about the NodeMcu timer function. So I am not alone. :)


This is how you use the Timer on NodeMCU (ESP8266) Author: simen, Translator: Ivan Chang
https://medium.com/maker-cup/this-is-ho ... 3574b444ce
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sun Oct 14, 2018 4:05 am

tlfong01 wrote:
Sat Oct 13, 2018 1:25 pm
tlfong01 wrote:
Sat Oct 13, 2018 12:41 pm
In other words, I can use external USB to TTL cable for ESPlorer program testing, but not for uploading firmware.
So I decided to try ESP8266-01 board which has no built in USB to TTL converter.
ESP8266-01 Test Results
However, there is one annoying thing, I need to power cycle or manual reset the board for each step of the chip_id, erase_flash, and write_flash operation.
This is reset/power cycle for every esptool command is a waste of time.
Anyway, I found ESP-01 (using external CH340G USB to TTL cable) disappointing. So I gave up and go back to play with the ESP12 NodeMCU board, carry on writing my first Lua program - blinky. I googled and found a guy also complaining about the NodeMcu timer function. So I am not alone. :)

ESP8266-01 vs ESP8266-12 NodeMcu Boards

After testing the ESP8266-01, I understand more why users without built in USB to TTL boards have firmware/program upload difficulties and problems. I also understand why Adafruit improves their Huzzah with Feather Hyzzah.


Adafruit Feather HUZZAH with ESP8266 WiFi
https://shop.pimoroni.com/products/adaf ... p8266-wifi

This is the Adafruit Feather HUZZAH ESP8266 - Adafruit's take on an 'all-in-one' ESP8266 WiFi development board with built in USB and battery charging. Its an ESP8266 WiFi module with all the extras you need, ready to rock!

At the Feather HUZZAH's heart is an ESP8266 WiFi microcontroller clocked at 80 MHz and at 3.3V logic. This microcontroller contains a Tensilica chip core as well as a full WiFi stack. You can progam the microcontroller using the Arduino IDE for an easy-to-run Internet of Things core. We wired up a USB-Serial chip that an upload code at a blistering 921600 baud for fast development time. It also has auto-reset so no noodling with pins and reset button pressings.

To make it easy to use for portable projects, Adafruit added a connector for any of their 3.7V Lithium polymer batteries and built in battery charging. You don't need a battery, it will run just fine straight from the micro USB connector. But, if you do have a battery, you can take it on the go, then plug in the USB to recharge. The Feather will automatically switch over to USB power when its available.

Here's some handy specs!

Measures 2.0" x 0.9" x 0.28" (51mm x 23mm x 8mm) without headers soldered in

Light as a (large?) feather - 9.7 grams

ESP8266 @ 80MHz with 3.3V logic/power

4MB of FLASH (32 MBit)

Built in WiFi 802.11 b/g/n

3.3V regulator with 500mA peak current output

CP2104 USB-Serial converter onboard with 921600 max baudrate for uploading

Auto-reset support for getting into bootload mode before firmware upload

9 x GPIO pins - can also be used as I2C and SPI

1 x analog inputs 1.0V max

Built in 100mA LiPoly charger with charging status indicator LED, can also cut a trace to disable the charger

Pin #0 red LED for general purpose blinking. Pin #2 blue LED for bootloading debug & general purpose blinking

Power/enable pin

4 mounting holes

Reset button

Comes fully assembled and tested, with a USB interface that lets you quickly use it with the Arduino IDE or NodeMCU Lua. (It comes preprogrammed with the Lua interpretter) Adafruit also toss in some header so you can solder it in and plug into a solderless breadboard.

Appendix - Adafruit boards

Adafruit HUZZAH ESP8266 Breakout
https://shop.pimoroni.com/products/adaf ... 6-breakout

Adafruit Feather HUZZAH with ESP8266 WiFi
https://shop.pimoroni.com/products/adaf ... p8266-wifi

Adafruit Feather M0 Express - Designed for CircuitPython - ATSAMD21 Cortex M0
https://shop.pimoroni.com/products/adaf ... -cortex-m0

Adafruit Feather nRF52 Pro with myNewt Bootloader - nRF52832
https://shop.pimoroni.com/products/adaf ... r-nrf52832

NodeMCU - Lua based ESP8266 development kit
https://shop.pimoroni.com/products/node ... escription

Pimoroni Wikipedia

Pimoroni Ltd is a hobbyist electronics company based in Sheffield, Yorkshire, UK.

Founded in 2012, the company has grown to more than 30 people and operates from two nearby properties in Sheffield city centre, as well as a third in Essen, Germany, which opened in 2017. In 2017 they were named the second fastest growing manufacturing company in the UK by the University of Sheffield.

Through an online store, and at community events, they are a re-seller for a number of electronics and education brands, as well as manufacturing a range of electronics and associated products. ... and their range now includes a selection of add-on boards and components for this and other small computers.

I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sun Oct 14, 2018 5:32 am

tlfong01 wrote:
Sun Oct 14, 2018 4:05 am
ESP8266-01 board which has no built in USB to TTL converter, ...
Adafruit Huzzah with Feather Hyzzah,...

Hong Kong Electronics Fair 2018 - Any Rpi or ESP8266 IoT there?

Hong Kong Electronics Fair 2018 is now on. Should I go this afternoon to look for any clever Esp8266 WiFi ideas I can steal?

HK Electronics Fair 2018 - 353 Wearable Electronics Products
https://event.hktdc.com/fair/hkelectron ... &view=list


Appendix - HKTDC Hong Kong Electronics Fair 2018 References

HKTDC Hong Kong Electronics Fair (Autumn Edition) 13-16 October 2018 Hong Kong Convention and Exhibition Centre

http://www.secartys.org/file-101247_101247.pdf

http://hkelectronicsfairae.hktdc.com/dm ... gmEALw_wcB

Categories
https://event.hktdc.com/fair/hkelectron ... n-Edition/

Events
https://event.hktdc.com/fair/hkelectron ... edule.html

Symposium (AI Empowerment - Grow without Limits)
http://hkelectronicsfairae.hktdc.com/pd ... posium.pdf

https://event.hktdc.com/fair/hkelectron ... Zones.html

Update 2018oct14hkt1847

Disappointedly, I did not find anything exciting, not to mention anything related to Rpi or Esp8266. I guess Shanghai and ShenZhen should be more interesting.
Last edited by tlfong01 on Sun Oct 14, 2018 10:51 am, edited 1 time in total.
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sun Oct 14, 2018 7:34 am

tlfong01 wrote:
Sat Oct 13, 2018 1:25 pm
Anyway, I found ESP-01 (using external CH340G USB to TTL cable) disappointing. So I gave up and go back to play with the ESP12 NodeMCU board, carry on writing my first Lua program - blinky.

Wemos D1 Mini and D1 Mini Pro

Now I am tidying up things to get prepared to start testing the Wemos D1 Mini and D1 Mini Pro

Wemos D1 mini - A mini wifi board with 4MB flash based on ESP-8266EX
https://wiki.wemos.cc/products:d1:d1_mini

Wemos D1 mini Pro - A mini wifi board with 16MB flash, external antenna connector and built-in ceramic antenna based on ESP-8266EX
https://wiki.wemos.cc/products:d1:d1_mini_pro
Attachments
esp8266_boards_2018oct1403.jpg
esp8266_boards_2018oct1403.jpg (179.17 KiB) Viewed 197 times
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sun Oct 14, 2018 11:27 am

tlfong01 wrote:
Sun Oct 14, 2018 7:34 am
Wemos D1 Mini and D1 Mini Pro
Now I am tidying up things to get prepared to start testing the Wemos D1 Mini and D1 Mini Pro
Wemos D1 mini - A mini wifi board with 4MB flash based on ESP-8266EX
https://wiki.wemos.cc/products:d1:d1_mini
Wemos D1 mini Pro - A mini wifi board with 16MB flash, external antenna connector and built-in ceramic antenna based on ESP-8266EX
https://wiki.wemos.cc/products:d1:d1_mini_pro

Wemos D1 Mini Pro GPIOs, reset switch, and LED

One main reason I prefer Wemos D1 Mini and Mini Pro is that their design is better than others.

Now I am going to add and external reset switch.
Attachments
d1_mini_pro_sch_2018oct1401.jpg
d1_mini_pro_sch_2018oct1401.jpg (185.06 KiB) Viewed 179 times
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sun Oct 14, 2018 11:57 am

tlfong01 wrote:
Sun Oct 14, 2018 11:27 am
Wemos D1 Mini Pro GPIOs, reset switch, and LED
One main reason I prefer Wemos D1 Mini and Mini Pro is that their design is better than others.
Now I am going to add and external reset switch.

ESP8266-12F FLASH and RAM

Now I am looking at the ESP8266-12F used by the Wemos D1 Mini Pro. I am surprised to find that there is only 36kB RAM!

ESP-12F WiFi Module WiFi Module Version1.0 - Ai-thinker
https://www.elecrow.com/download/ESP-12F.pdf

4.2. Memory Organization

4.2.1. Internal SRAM and ROM

ESP8266EX WiFi SoC is embedded with memory controller, including SRAM and ROM. MCU can visit the memory units through iBus, dBus, and AHB interfaces. All memory units can be visited upon request, while a memory arbiter will decide the running sequence according to the time when these requests are received by the processor.

According to our current version of SDK provided, SRAM space that is available to users is assigned as below:

* RAM size < 36kB, that is to say, when ESP8266EX is working under the station mode and is connected to the router, programmable space accessible to user in heap and data section is around 36kB.)

* There is no programmable ROM in the SoC, therefore, user program must be stored in an external SPI flash.

4.2.2. External SPI Flash

This module is mounted with an 4 MB external SPI flash to store user programs. If larger definable storage space is required, a SPI flash with larger memory size is preferred. Theoretically speaking, up to 16 MB memory capacity can be supported.

Suggested SPI Flash memory capacity:

* OTA is disabled: the minimum flash memory that can be supported is 512 kB;

* OTA is enabled: the minimum flash memory that can be supported is 1 MB.

Several SPI modes can be supported, including Standard SPI, Dual SPI, and Quad SPI.


Attachments
d1_mini_pro_brd_2018oct1401.jpg
d1_mini_pro_brd_2018oct1401.jpg (176.89 KiB) Viewed 172 times
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sun Oct 14, 2018 1:04 pm

tlfong01 wrote:
Sun Oct 14, 2018 11:57 am
Wemos D1 Mini Pro GPIOs, reset switch, and LED
One main reason I prefer Wemos D1 Mini and Mini Pro is that their design is better than others.

Wemos D1 Mini and Mini Pro and MicroPython

Another reason I like WeMos D1Mini is that they have newbie friendly tutorials on MicroPython. The following microPython workshop is good.

WeMos D1 Mini ESP8266 Micropython Workshop - 2016
https://micropython-on-wemos-d1-mini.re ... en/latest/

Getting started with MicroPython on the ESP8266
https://docs.micropython.org/en/latest/ ... intro.html

MicrtoPython Blink program
https://micropython-on-wemos-d1-mini.re ... asics.html

References

ESP8266 Micropython
http://micropython.org/resources/docs/e ... t/esp8266/

Forum
http://forum.micropython.org/.

#esp8266 and #micropython IRC network channels
http://freenode.net
Attachments
d1_mini_comm_2018oct1401.jpg
d1_mini_comm_2018oct1401.jpg (182.48 KiB) Viewed 164 times
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Mon Oct 15, 2018 6:52 am

tlfong01 wrote:
Sun Oct 14, 2018 5:32 am
Hong Kong Electronics Fair 2018 is now on. Should I go this afternoon to look for F]any clever Esp8266 WiFi ideas I can steal?
Update 2018oct14hkt1847
Disappointedly, I did not find anything exciting, not to mention anything related to Rpi or Esp8266. I guess Shanghai and ShenZhen should be more interesting.

Maker Faire Rome 2018
https://2018.makerfairerome.eu/en/

CM3-Home - Home Automation board for Raspberry Compute Module 3
https://interestingengineering.com/this ... smart-home
https://www.acmesystems.it/CM3-HOME
https://www.youtube.com/watch?time_cont ... xW-FZeLONY

I visited Maker Faire Rome 2018 and found them much more interesting. The Rpi CM3 Home is very impressive. I guess I can borrow some clever ideas from them. One thing I never heard of is ISM 868MHz.

Appendix - CM3 Home

CM3-Home - Home Automation board for Raspberry Compute Module 3
https://www.acmesystems.it/CM3-HOME
https://www.acmesystems.it/catalog_cm3home

CM3-Home is a Raspberry Pi Compute Module 3 mother board designed to provide a reliable Home Automation hardware equipped with a wide range of electrical interfaces

The CM3-Home board has been designed to be installed inside a DIN rail switchboard and implements protection against EMI and static charges to be installed in harsh environments.

This Device Gives Users the Power to Program Their Own Smart Home - Shelby Rogers October, 14th 2018

A new device on display at Makers Faire Rome 2018 leaves plenty of room for users to customize their smart home solutions and we got the interview!

Interesting Engineering at Maker Faire Rome 2018

The world continues to get more connected, and the Internet of Things grows rapidly grows each year. But one simple motherboard could give creative programmers the freedom to connect whatever they want, however they want.

The CM3-Home is a Raspberry Pi Compute Module 3 designed to give anyone the power to automate systems within their homes. The display was certainly turning heads at this year's Maker Faire Rome.

CM3-Home and the companion CM3-Panel came from Italian author, designer, and developer Guido Ottaviani. Ottaviani founded GUIOTT, a company where his creations and open source software can be accessed by anyone around the world.

INNOVATION

He deals with electronic design and embedded system firmware for Robotics and industrial and civil applications, as well as technical disclosure on the internet.

"The idea [for CM3-Home] came by knowing the Raspberry PI Compute Module 3 (CM3) that offers the capability to develop your own board," Ottaviani said in an exclusive interview with Interesting Engineering. "With an industrial, certified board, already populated with direct hardware interfaces, a lot of more possibilities come up compared to a standard Raspberry PI 3 with a bunch of USB adapters attached."

"The RPI 3 can be good for a maker or to develop the idea but when you need to install a real system in a real environment you need a professional board," he continued.

There's a growing need for automated technology. As more of these systems become available, the price will go lower and giving more people the opportunity to customize their own solutions.

"I guess right now there is all the technology to develop whatever you want in a reasonable price. In the moment that also IKEA came out with its Tradfri system, the domotics is for all of us, not just nerd, geeks or big manors for rich people," Ottaviani said.

"Automate home appliances will be more and more common for every environment, both domestic or industrial," he continued. "Wireless, not just WiFi but 868MHz or similar more reliable radio systems, will become more and more common on already installed houses. But they will still live together with the rock-solid wired systems for a lot of time."

Attachments
cm3_home_2018oct1501.jpg
cm3_home_2018oct1501.jpg (167.54 KiB) Viewed 145 times
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Wed Oct 17, 2018 3:23 am

tlfong01 wrote:
Sun Oct 14, 2018 5:32 am
tlfong01 wrote:
Sun Oct 14, 2018 4:05 am
ESP8266-01 board which has no built in USB to TTL converter, ...
Adafruit Huzzah with Feather Hyzzah,...

Hong Kong Electronics Fair 2018 - Any Rpi or ESP8266 IoT there?

Hong Kong Electronics Fair 2018 is now on. Should I go this afternoon to look for any clever Esp8266 WiFi ideas I can steal?

HK Electronics Fair 2018 - 353 Wearable Electronics Products
https://event.hktdc.com/fair/hkelectron ... &view=list


Appendix - HKTDC Hong Kong Electronics Fair 2018 References

HKTDC Hong Kong Electronics Fair (Autumn Edition) 13-16 October 2018 Hong Kong Convention and Exhibition Centre

http://www.secartys.org/file-101247_101247.pdf

http://hkelectronicsfairae.hktdc.com/dm ... gmEALw_wcB

Categories
https://event.hktdc.com/fair/hkelectron ... n-Edition/

Events
https://event.hktdc.com/fair/hkelectron ... edule.html

Symposium (AI Empowerment - Grow without Limits)
http://hkelectronicsfairae.hktdc.com/pd ... posium.pdf

https://event.hktdc.com/fair/hkelectron ... Zones.html

Update 2018oct14hkt1847

Disappointedly, I did not find anything exciting, not to mention anything related to Rpi or Esp8266. I guess Shanghai and ShenZhen should be more interesting.

Update 2018oct17hkt1111

I browsed Hongkong Electronics Fair 2008 web pages to try to find products on home automation but only find the plant automation thing called Parrot. I read another article saying that plant sensor systems have not been doing well.

Smart Garden and Smart Sprinkers reading notes

Is the smart garden growing or wilting?
https://www.cnet.com/news/is-the-smart- ... r-wilting/

... a close look at the state of the smart garden.

... two main categories of smart garden tech so far have been smart plant sensors and smart sprinklers. One category has indeed moved beyond the early adopter phase and become almost standard.

The other has faded from relevance and become even more of a niche product.

Back in 2014, I reviewed three products in a relatively new category of connected tech called plant sensors. ...

Compared to the other major smart outdoor categories -- smart sprinklers, robot lawnmowers and weather sensors -- plant sensors looked like the most accessible entry point.

But anyone could make use of a plant sensor, whether they wanted to monitor an extensive garden bed or a small potted plant. Because of that accessibility, I wrongly pegged smart plant sensors as the category that would help lead the smart garden to prominence.

Fast forward to 2018 and smart plant sensors have all but disappeared.

The four plant sensors I reviewed are all off the market.

The two with the highest profiles -- the Parrot Flower Power and the Edyn Garden Sensor -- have vanished entirely.

Parrot is no longer making smart garden gadgets and the promising Edyn isn't selling anything at the moment.

Others, such as the Wimoto Grow, never came to fruition. Try to buy a plant sensor now and Amazon pulls up a small handful of unexciting options that all appear to be produced by the same manufacturer.

In stark contrast to plant sensors, smart sprinklers seemed too expensive and too niche to gain much popularity. Smart sprinklers replace your existing sprinkler controller for your in-ground sprinklers. If you don't have a home with a built-in sprinkler system, you have no use for a smart sprinkler.

Perhaps because smart sprinklers targeted specific consumers, they've flourished while plant sensors faltered.

Smart sprinklers seem to have flourished while plant sensors faltered by offering a clear benefit and a polished user experience to a specific group of consumers.

Wifi Plant Watering Sensor System
https://www.postscapes.com/wireless-plant-sensors/

Raspberry Pi based garden monitoring system supplies five sensors - 2018oct16
http://linuxgizmos.com/raspberry-pi-bas ... e-sensors/

SwitchDoc Labs’ “Smart Garden System” is a Raspberry Pi and Grove-based environmental monitoring and plant watering system with sensors for soil moisture, sunlight, air quality, temperature, and humidity.

Spokane Valley, Wash. based SwitchDoc Labs (SDL) has launched a more advanced, up to nine plant Smart Garden System (SGS) kit version of its earlier SmartPlantPi kit. The Raspberry Pi based kit, which requires no soldering, is promoted as being an educational system for learning about gardening as well as the Raspberry Pi and IoT technology.

The SGS provides feedback on a the plants’ environment, soil, and condition, and is capable of remote notifications and automatic watering. The SGS follows other Raspberry Pi based gardening kits that have launched this year including the BioControle and OpenMinder.

Like the SmartPlantPi, the SGS is being funded on Kickstarter. It surpassed its funding goal with 13 days left and is available for $115 with 3D printed stand and one plant sensor, or $175 with a kit that adds a Raspberry Pi 3 B+, 5V/2A power supply, nylon standoffs, and pre-loaded SD card. There are also “Full SGS” kits with 4- or 8-plant extender boards starting at $255. Shipments are due in November.

The kit attaches I2C connected sensors to the Pi via one of Seeed’s unnamed, Raspberry Pi Grove connector boards. The final product will reduce the cable clutter seen in the images of the prototype:

The basic SGS kit consists of:
Grove connector board for the Raspberry Pi
SI1145 sunlight/IR/UV sensor
Sensitive Grove air quality sensor
Grove ultrasonic water level sensor
Capacitive soil moisture sensor
HDC1080 indoor temperature and humidity sensor
4-channel, 16-bit ADC
8-pixel RGBW strip
Grove OLED 128 x 64 display
8 x 20cm Grove cables and 1x 50cm Grove cable
USB PowerControl NE solid state relay
USB activated pump
Hose (200mm) with clip
3D printed ultrasonic holder and SGS stand

The Full SGS model extends the SGS with one or two 4 Plant Extender Boards with built-in USB pump controls and ADC. You also get 4x USB controlled pumps, 4x capacitive moisture sensors, and the power supply. The full kits, which ship with or without a Raspberry Pi 3 B+, also boost the number of cables and the length of the hose, as well as offering a larger stand.

On the software side you get a Raspbian based stack that offers access to the Blynk smartphone app for monitoring and control. Full Python based source code and 3D printer files are available.
I am an electronics, smart phone, and smart home hobbyist.

User avatar
tlfong01
Posts: 571
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: GPIO.input voltage levels vs edge detection

Sat Oct 20, 2018 11:32 am

petermeigs wrote:
Wed Oct 10, 2018 7:09 am
You see a mini-usb connector for power and I'll use a LD1117 to drop a 5vdc power supply (I have many of these left over from old phones and other devices) to 3.3v.

Using Wall Warts

I don't usually use wall warts, because they often have thin wires which might drop too much voltage if the current is large. I learnt my lesson when playing with old versions of Rpi. You might like to read the following interesting and comprehensive article about using wall wart.

AC-DC Power Supplies - Using Wall Warts - Jon Chandler 2011mar01
http://digitaldiy.io/articles/electroni ... wall-warts

(Using a adjustable voltage wall wart) RE: RELAY MODULE KY-019 5V- tlfong01 2018-Oct-18
viewtopic.php?f=37&t=77158&sid=fd58686b ... 5#p1381664
I am an electronics, smart phone, and smart home hobbyist.

Return to “Python”

Who is online

Users browsing this forum: No registered users and 9 guests