need help with 74HC04 chip to invert high to low

I'm working on an adafruit sound fx board. The sounds are generated when a pin is connected to ground. I was planning on triggering it remotely by using a Wemos.

So my problem is converting the high from the LED on the wemos to produce a low/ground to the sound board.

The adafruit page showing an 74HC04 inverter chip:

https://learn.adafruit.com/audio-fx-remote-control/costume-use?view=all

I purchased one off ebay the markings on it say "SN74HC04N". Did I get the wrong chip. I've played around with it and can't seem to trigger a sound other than connecting trigger pins directly to ground.

74HC04 Pin 1 connected to the Wemos pin D1 which the LED lights up Pin 2 to trigger pin on audiofx board. Pin 7 GND Pin 14 VCC

What am I doing wrong? I've never used an inverter chip and maybe just not using it correctly.

Something's not connected correctly (or maybe the part is bad?). Did you remember to connect the grounds?

Also - why not just use an npn transistor and two resistors? Base via series resistor to led pin, emitter to ground, collector to pin on sound board, and pin on sound board pulled up to vcc.

You also need to connect all unused inputs on the 74HC04 to either ground or Vcc. Don’t just leave them floating.

And the 74HC04 is a static-sensitive chip, so if you’ve mis-handled it, (touched the pins with your fingers etc), there’s a chance it’s dead.

Also, as DrAzzy says, if you’re only controlling one pin, a single transistor is all you really need. A hex inverter is only really useful if there are multiple pins being controlled.

My guess, (to quote DrAzzy), is this:- “Did you remember to connect the grounds?”

I was thinking npn/pnp but not used them either. I just ordered the subject chip because that's what is used in adafruits tutorial. So the NPN is going to pull the circuit to ground when voltage is applied, somewhat like a relay switch?

If I were to use the chip I have, ALL the unused pins should be to ground?

I think an NPN transister would be much easier as I am only using 1 pin for random sounds to be played. What NPN specific should I be looking at? I'm sure there's probably thousands out there that do different things.

As always, THANK YOU for your input.

DrAzzy: pin on sound board pulled up to vcc.

This won't damage the sound board? I doubt it since you suggested it but I have to ask for my own benefit because I don't know. I would then assume they put in a diode to "idiot proof" it for knuckle heads like me.

marine_hm: I was thinking npn/pnp but not used them either. I just ordered the subject chip because that's what is used in adafruits tutorial. So the NPN is going to pull the circuit to ground when voltage is applied, somewhat like a relay switch?

Yep. You use a pullup resistor from the pin to 5V to hold it high, then the NPN transistor pulls it low when it's activated. A 10K resistor would be fine.

If I were to use the chip I have, ALL the unused pins should be to ground?

All unused inputs, as I said. Definitely not the unused outputs. When using a chip for the first time, you should always check out the datasheet for guidance. It would make this point clear. It applies to all chips with CMOS inputs.

I think an NPN transister would be much easier as I am only using 1 pin for random sounds to be played. What NPN specific should I be looking at? I'm sure there's probably thousands out there that do different things.

Probably the most common transistor for this purpose is the BC548, but any NPN small-signal transistor would do the job. Besides the pullup resistor that I mentioned, you'd need a series resistor from the Arduino pin to the base of the transistor. Again, 10K should be fine.

Are you connecting your Wemos? directly to the Adafruit sound card I.e. Not through the RF device mentioned in the quoted article ? Why not for testing simply use another pin on the Wemos and set it high or low as required in you sketch?

First off you got the right chip.
Next if you simply connected the input to the anode of an LED ( and connected the ground to the cathode ), there is not enough voltage to turn on the logic gate and so the output will always be high. This assumes the current limiting resistor is in the anode of the LED. If your “thing” is a 5 V system then connect your gate input to the other end of the LED’s resistor.

While all inputs should be connected to something, it is not something that will stop the gate working. In fact I have never had problems with this when testing circuits.

Having said that then a transistor would be simpler.

Grumpy_Mike: While all inputs should be connected to something, it is not something that will stop the gate working. In fact I have never had problems with this when testing circuits.

I should have mentioned that leaving them open won't stop it working, (although it is theoretically possible to damage the chip), but it's just good practice not to leave unused inputs floating due to excessive current draw.

Yes what could happen is the chip could oscillate and generate interference. Current draw would increase but only to what it could be if fed with those fast signals.

Grumpy_Mike: Yes what could happen is the chip could oscillate and generate interference. Current draw would increase but only to what it could be if fed with those fast signals.

It can potentially be damaging, if the input spends too long at the threshold.

From the Texas Instruments application note SCBA004D, "Implications of Slow or Floating CMOS Inputs":-

.....causing the N-channel and the Pchannel to turn on simultaneously, generating a current path between VCC and GND. This current surge can be damaging, depending on the length of time that the input is in the threshold region

Doesn't mean it will happen, but it can.

With the wemos as I have it now, It just seems too much transition time turning on/off the LED when touching the capacitive momentary switch. Maybe it's just the way I'm using the wemos currently. I have one as an AP and 4 others as a station. I could simplify this to 1 station for this project. Just have the AP turn the LED on the station for second and turn right back off? Then integrate the NPN for the trigger pin on the sound board.

What do you guys think?

Radioshack should have NPNs so I won't have to buy online. I'll be back.

Thanks

OK you have one but what is a wemos and how are you wiring it up?

6v6gt:
Are you connecting your Wemos? directly to the Adafruit sound card I.e. Not through the RF device mentioned in the quoted article ?
Why not for testing simply use another pin on the Wemos and set it high or low as required in you sketch?

Thanks for the idea. Yes, wired directly to the wemos. So here are my two sketches:
AP sketch with capacitive touch switch

#include <ESP8266WiFi.h>

extern "C" {
#include "user_interface.h"
}

char apName[] = "SoundFx";
char apPassword[] = "Adafruit";

void setup() {
  Serial.begin(115200);
  delay(100);

  WiFi.softAP(apName, apPassword);
  WiFi.mode(WIFI_AP);

  pinMode(D1, INPUT_PULLUP); / not sure what to put here
  Serial.println();
  Serial.println("AP Started");
}

int value = 0;
int stations = -1;

void loop() {

  int stationsNow = wifi_softap_get_station_num();
  if (stations != stationsNow) {
    stations = stationsNow;
    Serial.print("Station count: ");
    Serial.println(stations);
  }

  int newValue = digitalRead(D1);

  if (newValue != value) {
    value = newValue;
    Serial.print("value=");
    Serial.println(value);

    struct station_info *stat_info;
    struct ip_addr *IPaddress;
    unsigned long uintaddress;

    Serial.println("Updating connected stations...");

    stat_info = wifi_softap_get_station_info();
    while (stat_info != NULL) {

      IPaddress = &stat_info->ip;
      uintaddress = IPaddress->addr;
      String host = String(ip4_addr1(&uintaddress)) + "." + ip4_addr2(&uintaddress) + "." + ip4_addr3(&uintaddress) + "." + ip4_addr4(&uintaddress);

      Serial.print("connecting to ");
      Serial.println(host);

      // Use WiFiClient class to create TCP connections
      WiFiClient client;
      const int httpPort = 80;
      if (!client.connect(host.c_str(), httpPort)) {
        Serial.println("connection failed");
      }
      else {

        // We now create a URI for the request
        String url;
        if (value == HIGH) {
          url = "/LED=ON";
        }
        else {
          url = "/LED=OFF";
        }
        Serial.print("Requesting URL: ");
        Serial.println(url);

        // This will send the request to the server
        client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                     "Host: " + host + "\r\n" +
                     "Connection: close\r\n\r\n");
        delay(50);

        // Read all the lines of the reply from server and print them to Serial
        while (client.available()) {
          String line = client.readStringUntil('\r');
          Serial.print(line);
        }

        Serial.println();
        Serial.println("closing connection");
      }
      client.flush();
      client.stop();
      stat_info = STAILQ_NEXT(stat_info, next);
    }
    Serial.println("All connected stations updated.");
  }
}

Station sketch with the other wemos attached to the soundfx board:

#include <ESP8266WiFi.h>

const char* ssid = "SoundFx";
const char* password = "Adafruit";

int ledPin = D1;
int triggerPin = D4;
WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  delay(10);

  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, HIGH);

  pinMode(triggerPin, OUTPUT);
  digitalWrite(triggerPin, HIGH);

  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  WiFi.mode(WIFI_STA);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    digitalWrite(ledPin, HIGH);
    Serial.print(".");
    delay(50);
    digitalWrite(ledPin, LOW);
  }
  Serial.println("");
  Serial.println("WiFi connected");

  // Start the server
  server.begin();
  Serial.print("Server started on ");
  Serial.println(WiFi.localIP());

  digitalWrite(ledPin, HIGH);
  delay(500);
  digitalWrite(ledPin, LOW);

}

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (client) {

    // Wait until the client sends some data
    Serial.println("new client");
    while (!client.available()) {
      delay(1);
    }

    // Read the first line of the request
    String request = client.readStringUntil('\r');
    Serial.println(request);
    client.flush();

    // Match the request

    int value = LOW;
    if (request.indexOf("/LED=ON") != -1) {
      digitalWrite(ledPin, HIGH);
      digitalWrite(triggerPin, LOW);
      value = HIGH;
    }
    if (request.indexOf("/LED=OFF") != -1) {
      digitalWrite(ledPin, LOW);
      digitalWrite(triggerPin, HIGH);
      value = LOW;
    }

    // Set ledPin according to the request
    //digitalWrite(ledPin, value);

    // Return the response
    client.println("HTTP/1.1 200 OK");
    client.println("Content-Type: text/html");
    client.println(""); // do not forget this one

    client.print("Led pin is now: ");

    if (value == HIGH) {
      client.print("On");
    } else {
      client.print("Off");
    }
    client.println(""); // do not forget this one
    client.flush();
    client.stop();
    Serial.println("Client disconnected");
    Serial.println("");
  }

}

It works somewhat. Instead of triggering the sound when the button is pressed, it loops until I press the button So I know at least it will work without the inverter chip. I just have to find the HIGH/LOW for the button press and swap the value. That should work. Then I would like to pull out all the extra code NOT needed for this project to speed up the response of whether the button is pressed or not.

Grumpy_Mike: OK you have one but what is a wemos and how are you wiring it up?

Wemos is a tiny little ESP 8266 wifi board. http://www.ebay.com/itm/D1-Mini-NodeMcu-4M-bytes-Lua-WIFI-Development-Board-ESP8266-by-WeMos-/182035363514?hash=item2a622736ba:g:NSYAAOSwe7BWzu4m

Currently on a breadboard with jumper wires till I get it working. 1st Wemos is the Access Point, connected to a Capacitive touch switch. 2nd Wemos is the Station, connected to the AudioFX boards trigger pin. The AudioFx output to 2.5 W audio Amp, then .5W speaker.

So not the thing you get when you google Wemos, it would have been good to know that at the start. That board is a 3V3 board and so is not very suited to driving 5V TTL especially if you are only taking the input from a diode. I wait in breathless anticipation for how you are wiring it up. That means schematic.

Turns out I didn't need the NPN transistor or the 74HC04 chip at all.

In my wemos "station" sketch I have assigned an ledPin (D1) and triggerPin (D7) in the setup. Assigned the led pin =LOW and triggerPin =HIGH. When the button on the Wemos AP is pressed, the station ledpin goes HIGH, the triggerPin goes LOW waits milisecond, then triggerPin =HIGH

    int value = LOW;
    if (request.indexOf("/LED=ON") != -1) {
      digitalWrite(ledPin, HIGH);
      digitalWrite(triggerPin, LOW);
      delay(250);
      digitalWrite(triggerPin, HIGH);
      value = HIGH;
    }

No inverting necessary.