Page 5 of 7

Re: Chat here about Hardware Specific topics

PostPosted: Mon Jul 31, 2017 7:05 pm
by timg11
I put my module's board under the microscope and traced the switch to D0, and it is connected.
So apparently the other article about D0 not being connected to the switch on models without the LED hole was incorrect.

When hooked the board back up again, and powered up while holding the switch, I was able to successfully flash from the Arduino IDE. So I'm up and running, but still unsure why the flashing process failed before.

Re: Chat here about Hardware Specific topics

PostPosted: Sat Sep 09, 2017 8:39 am
by heweb
Well, i am new at this site and owning an ESP8266 (wemos d1 retired) since some days.
But i have some experience with Arduino.

I think, there are two easy possibilities:

1) Poll the switches attached to input pins. This could be done within a timer-interrupt for example
10 times a second. Take in account to debounce the switches with hard- or software.

2) Let the switches do an pin interrupt (debouncing is necessary as well)

I tested 2) to check, how many interrupts this blinding fast machine could handle:

A program that toggles GPIO 5 in a timer interrupt and an interrupt routine to get this toggling as an input for a pin interrupt. Up to 100000 interrupts per second are possible. Try it.
You could learn, how to handle timer interrupts and pin interrupts. Have fun ;)
Code: Select all/*
 * ESP8266 Wemos D1 (retired) 160 Mhz
 * 100000 pin-interrupts per second !
 * Helmut Weber 9.9.2017
 * GPIO 4  and GPIO 5 must be connected
 * This programm creates pin interrupts at pin 4
 * by timer interrupts toggling pin 4
* The output from pin 4 is connected to pin 5 as input.
* A pin interrupt routine at pin 5 is called by the falling edge of the signal

// Adresses of port-register
#define PIN_DIR       0x6000030C
#define PIN_OUT_SET   0x60000304
#define PIN_OUT_CLEAR  0x60000308

unsigned int *pdir, *poset, *poclear;

const byte interruptPin = 4;
const byte timerPin = 5;
volatile unsigned long interruptCounter = 0;
volatile unsigned long numberOfInterrupts = 0;

volatile char flag=0;;

void timerhandler() {
  // rearm timer

  // VERSION 1
  timer0_write(ESP.getCycleCount() +680L);
  // VERSION 2
  //timer0_write(ESP.getCycleCount() +79850L);

  if (flag==0) {
    // clear pin 5 = GPIO 5
  else {
    // set pin 5

void setup() {

  // ____________ init ports direct _____________
  // define pointer to ports
  pdir=(unsigned int *)PIN_DIR;
  poset=(unsigned int *)PIN_OUT_SET;
  poclear=(unsigned int *)PIN_OUT_CLEAR;
  pinMode(interruptPin, INPUT_PULLUP);
  pinMode(timerPin, OUTPUT);
  attachInterrupt(digitalPinToInterrupt(interruptPin), handleInterrupt, FALLING);

  timer0_write(ESP.getCycleCount() +80000000L);

unsigned long lastCounter=0;
unsigned long lastTime=0;
unsigned long thisTime=0;

void handleInterrupt() {
void loop() {
      Serial.printf("%d in interrupts in %d microseconds\n ",interruptCounter-lastCounter, thisTime-lastTime );

  // VERSION 1

  // Version 2

 This is the output of the program VERSION 1
 100099 in interrupts in 999960 microseconds
 100104 in interrupts in 1000010 microseconds
 100097 in interrupts in 999935 microseconds
 100105 in interrupts in 1000015 microseconds
 100093 in interrupts in 999892 microseconds
 100100 in interrupts in 999958 microseconds
 99860 in interrupts in 997572 microseconds
 99869 in interrupts in 997690 microseconds
 99843 in interrupts in 997351 microseconds
 100112 in interrupts in 1000088 microseconds
 100102 in interrupts in 999987 microseconds
 100096 in interrupts in 999922 microseconds

 This is the output of the rogram VERSION 2
 1001 in interrupts in 999998 microseconds
 1000 in interrupts in 999940 microseconds
 1000 in interrupts in 999992 microseconds
 1001 in interrupts in 1000009 microseconds
 1000 in interrupts in 1000029 microseconds
 1000 in interrupts in 999949 microseconds
 1000 in interrupts in 999989 microseconds
 1000 in interrupts in 999940 microseconds
 1001 in interrupts in 1000014 microseconds
 1000 in interrupts in 999968 microseconds
 1000 in interrupts in 1000033 microseconds

A timer interrupt every 10ms should do your job fine

Re: Chat here about Hardware Specific topics

PostPosted: Fri Oct 13, 2017 5:46 am
by ukrsms
Hi, All
I'm using the ESP8266 module for WIFI communications but there is one thing caused a great problem for our device. We use Soft AP to set credentials for the ESP to connect it to a router. But the problem is that we use open WIFI net without security and sometimes all available channels become busy :twisted: before I started to connect to AP. I looked through the documentation but haven't found any information how could ESP itself disconnect some station from its WIFi. Could someone help me to solve the problem?

Re: Chat here about Hardware Specific topics

PostPosted: Tue Feb 20, 2018 12:53 am
by anurag2508

I am Anurag. I need answer to the problem which I am facing now and not able to find the solution for this.
Actually I have interfaced ADXL_345 with Nodemcu ESP8266 using SPI and code is working fine. The problem is Once the code is uploaded with usb power it works and receives data but next time if I reconnect usb and repower it including battery or trough USB I have to reupload the code again to the nodemcu for it to work.
Please let me know if anyone has solution for this issue.