CH376S connectivity issue with ESP8266

As mentioned I am using a CH376S board with ESP8266

My target is to apply a USB keyboard as input device replacing digital inputs, analog inputs or keypad type such things to assign maximum number of task at a time

Is there any possibility of implanting this idea I am looking for ??

very latest code I am working on is here :


// The serial terminal is used to monitor the commands executions and the reply received from the CH376s IC
// The example shows how to crete,manipulate and delete files and directories
// The example shows also how to log data to a csv file

#include <CH376s.h>

#define Tx  1
#define Rx  3

int const TX_pin = Tx;
int const RX_pin = Rx;

byte computerByte;           //used to store data coming from the computer

CH376s CH376(Rx,Tx);                        // define class name
                                                 
//==============================================================================================================================================
void setup() {
  Serial.begin(9600);                       // Setup serial communication with the computer (using a baud rate of 9600 on serial monitor)
  delay(3000);
  Serial.print("Hello ");
  delay(3000);
  CH376.init();                             // Init the connection with CH376 and check the USB status
  delay(3000);
}

void loop() {
  if(Serial.available()){
    computerByte = Serial.read();                    
      if(computerByte==49){                         // If number 1 from the serial monitor is received
        // CH376.checkConnection();                    // Check for successful connection and communication with the CH376S module.
        Serial.print("OMG");
        }        
  }
  CH376.checkUnexpectMsg();                         // Check for unexpected data transmitted by the CH376S module
}


But I am unable to get any responce

I just want to have display of key pressed on keyboard on the serial monitor which is going to include numeric , special characters, lower case and upper case alphabets, etc

Please guide !!

Please read the pinned post 'how to get the most ut of the forum. Next look for the post on Serial at https://forum.arduino.cc/t/serial-input-basics-updated/382007

Sorry Sir, I dint get this line here !!

I think that is for direct USB keyboard or something but not including external peripherals like I am currently working with CH376S module

Though I have designed this


// The serial terminal is used to monitor the commands executions and the reply received from the CH376s IC
// The example shows how to crete,manipulate and delete files and directories
// The example shows also how to log data to a csv file

#include <CH376s.h>

#define Tx  1
#define Rx  3

int const TX_pin = Tx;
int const RX_pin = Rx;

byte computerByte;           //used to store data coming from the computer

CH376s CH376(Rx,Tx);                        // define class name

// char receivedChar;
boolean newData = false;

const byte numChars = 32;
char receivedChars[numChars];   // an array to store the received data

//==============================================================================================================================================
void setup() {
  Serial.begin(9600);                       // Setup serial communication with the computer (using a baud rate of 9600 on serial monitor)
  delay(3000);
  Serial.print("Hello ");
  delay(3000);
  CH376.init();                             // Init the connection with CH376 and check the USB status
  delay(3000);
}

void loop() {
  // if(Serial.available()){
  //   computerByte = Serial.read();                    
  //     if(computerByte==49){                         // If number 1 from the serial monitor is received
  //       // CH376.checkConnection();                    // Check for successful connection and communication with the CH376S module.
  //       Serial.print("OMG");
  //       }        
  // }
  // CH376.checkUnexpectMsg();                         // Check for unexpected data transmitted by the CH376S module
  recvWithEndMarker();
    showNewData();
}

void recvWithEndMarker() {
    static byte ndx = 0;
    char endMarker = '\n';
    char rc;
    
    while (Serial.available() > 0 && newData == false) {
        rc = Serial.read();

        if (rc != endMarker) {
            receivedChars[ndx] = rc;
            ndx++;
            if (ndx >= numChars) {
                ndx = numChars - 1;
            }
        }
        else {
            receivedChars[ndx] = '\0'; // terminate the string
            ndx = 0;
            newData = true;
        }
    }
}

void showNewData() {
    if (newData == true) {
        Serial.print("This just in ... ");
        Serial.println(receivedChars);
        newData = false;
    }
}

But still no response !!

In fact , the keyboard indicators for caps lock, num lock is not glowing or not working on operating it

What is going on actually ?

Post all the code in code tags, any error logs in code tags, and a wiring diagram, a photo of a hand drawn is fine.

Ya I posted it under the code tag , you can check it

No errors are there but simply the system is not working, keyboard is not having any light
I tested , USB hub has 5v supply available

photo is coming soon !!

I am under the impression that the CH376 is not a USB Host exactly. It's really just a USB thumbdrive interface.

That's it !!

O I see !

Sir, then how to achieve the target I am looking for ?

Sounds like a job for a RaspberryPi (the real RPi, not a Pico or PicoW, etc).

Anything we can derive it from this one ??

Just a basic idea from this

Or anything like that ??

but it is saying like this here

Did you fail to read the following?

The chip can do more, e.g to handle HID devices(usb keyboard, mouse, joystick ...) but this feature is not yet used in the library, maybe in the future.

USB Flash Disk Drive Module Read/Write USB Host Module
I believe that, to the extent that it's a 'Host', it's a limited host - limited to hosting the thumbdrive.

I am done with this since it is NOT supported by this hardware/software. Goodbye.

So what should I do now ?
Which module what to write ?

:frowning:

Ya this one is mine

I thought you have a ESP32.

There are probably more like it.
Refer all questions to that guy.

Ya I also have ESP32 WROOM MODULE

But I am currently working on ESP8266

I can switch to ESP32 , no issues

I anyhow , have to achieve this goal.