User Tools

Site Tools


kits:pwm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
kits:pwm [2021/11/01 14:36] – created James Sentmankits:pwm [2023/10/23 14:01] (current) – added new GPIO functions for indicators and sample player James Sentman
Line 70: Line 70:
   * **IR Receiver:** An IR receiver device (not just a simple phototransistor) can be connected to any of the first 8 GPIO inputs. Powered from the 3.3v and gnd rail on the device with the data output connected to the GPIO pin. (more info on this as well as an Expander card to support multiple inputs and even outputs is in the works) When you point a remote at it and press a button a unit in XTension will be created with the code of the button as it’s address and will receive an ON event whenever the same code is received again. Not all remotes may be supported but only those with the most common modulation rates and such but is a way to get a remote output from a remote to do some other action in XTension.   * **IR Receiver:** An IR receiver device (not just a simple phototransistor) can be connected to any of the first 8 GPIO inputs. Powered from the 3.3v and gnd rail on the device with the data output connected to the GPIO pin. (more info on this as well as an Expander card to support multiple inputs and even outputs is in the works) When you point a remote at it and press a button a unit in XTension will be created with the code of the button as it’s address and will receive an ON event whenever the same code is received again. Not all remotes may be supported but only those with the most common modulation rates and such but is a way to get a remote output from a remote to do some other action in XTension.
   * **Servo:** A servo control output on any of the first 8 GPIO pins. The hertz of the output as well as the max and minimum position outputs are configurable in the interface once selecting this. Most servos are 5v and so must have their own power supply to power them. This will also better serve to isolate the noise generated by the motors. When powering one via an external power supply the gnd side of that power supply must be connected to the gnd output of the GPIO card so that the 2 devices can send data to each other. Otherwise it will not see the control pulses. The ground to the board power supply and the data connection from the GPIO pin to the pwm input on the servo is all that is required. The device in XTension will have a min/max value of what you set in the interface and controlling it will set the location of the servo. (BETA: as of this moment there is no rate control, the servo will change immediately and as fast as it can from the one position to the other. Future builds will have the ability to set a rate and possibly a curve for the change so that it can be more smooth.) This PWM could also be used to control brushless motor speed via a proper ESC using the output from the card as the input to the ESC. (BETA: As of the current beta this is totally untested, I have yet to get to the part on the list where I even connect one to the board, but the software is as complete as it can be without testing)   * **Servo:** A servo control output on any of the first 8 GPIO pins. The hertz of the output as well as the max and minimum position outputs are configurable in the interface once selecting this. Most servos are 5v and so must have their own power supply to power them. This will also better serve to isolate the noise generated by the motors. When powering one via an external power supply the gnd side of that power supply must be connected to the gnd output of the GPIO card so that the 2 devices can send data to each other. Otherwise it will not see the control pulses. The ground to the board power supply and the data connection from the GPIO pin to the pwm input on the servo is all that is required. The device in XTension will have a min/max value of what you set in the interface and controlling it will set the location of the servo. (BETA: as of this moment there is no rate control, the servo will change immediately and as fast as it can from the one position to the other. Future builds will have the ability to set a rate and possibly a curve for the change so that it can be more smooth.) This PWM could also be used to control brushless motor speed via a proper ESC using the output from the card as the input to the ESC. (BETA: As of the current beta this is totally untested, I have yet to get to the part on the list where I even connect one to the board, but the software is as complete as it can be without testing)
 +  * **Neopixel Indicator:** A short string of Adafruits “neopixels” or other WS2812 type compatible LEDs can be hung off one or more of the GPIO pins for status indication or alerts. This is not a WLED show or animation machine. The LED’s can have their color and brightness set as well as flashing between colors, or fading to a color or off. More information and documentation for the commands is on the [[:kits:pwm:indicator|]] wiki page.
 +  * **MP3 Sample Player:** A GPIO line can be used to send commands to any one of the many “DF Player” compatible MP3 players. Any sample player that claims compatibility with Arduino via the DFPlayer library should work. This could be useful for playing alert sounds or other informational sounds. No support is provided to treat the device as a music player, just commands to play specific sound files from either the built in memory or a CF card as well as volume and some other basic settings. The commands added for this are documented on the [[:kits:pwm:mp3player]] page.
   * **Output (LOW at power on):** GPIO output with the value set to LOW at startup. See limitations on output current and voltage above. At startup the output will be connected to GND. Additionally there is a “reverse logic” button that will reverse how the interface and XTension show and control the output. It will still startup as LOW however, the interface will just show the output as ON if that is selected.   * **Output (LOW at power on):** GPIO output with the value set to LOW at startup. See limitations on output current and voltage above. At startup the output will be connected to GND. Additionally there is a “reverse logic” button that will reverse how the interface and XTension show and control the output. It will still startup as LOW however, the interface will just show the output as ON if that is selected.
   * **Output (HIGH at power on):** Same as the above except that the output will be HIGH or connected to 3.3v at startup.   * **Output (HIGH at power on):** Same as the above except that the output will be HIGH or connected to 3.3v at startup.
   * **Output Return To Previous State:** Same as the above but the output will return to it’s last controlled state when the device is powered on. Note that when starting from a power off state there may be some uncertainty of the output state until the firmware has loaded. If you need to make sure that an output is on or off when powered down please use an external pull up and pull down resistor in addition to the setting to make sure there are no quick changes when powering on. When rebooting via the web interface while changing values the state is preserved and no flickering should occur.    * **Output Return To Previous State:** Same as the above but the output will return to it’s last controlled state when the device is powered on. Note that when starting from a power off state there may be some uncertainty of the output state until the firmware has loaded. If you need to make sure that an output is on or off when powered down please use an external pull up and pull down resistor in addition to the setting to make sure there are no quick changes when powering on. When rebooting via the web interface while changing values the state is preserved and no flickering should occur. 
-  * **Output Analog Voltage:** GPIO 5 and 7 support outputting an analog voltage between 0 and 3.3v. Make sure you properly limit the current output from this. The unit in XTension will let you set the level. See the ESP32 DAC documentation for more info on what is possible and how to properly use it. 
   * **Encoder Lines:** 2 optical encoders can be connected to the GPIO pins. Each one will require 2 inputs an A and a B with the common attached to the 3.3v rail. (BETA: in the PWM device these can be used to directly control the level of outputs, they serve no function yet in the GPIO board but will eventually be able to create a unit in XTension for them or to directly control a separate PWM dimmer device.) Most encoders also have a push button output which could be connected to another GPIO pin to get that input into XTension.   * **Encoder Lines:** 2 optical encoders can be connected to the GPIO pins. Each one will require 2 inputs an A and a B with the common attached to the 3.3v rail. (BETA: in the PWM device these can be used to directly control the level of outputs, they serve no function yet in the GPIO board but will eventually be able to create a unit in XTension for them or to directly control a separate PWM dimmer device.) Most encoders also have a push button output which could be connected to another GPIO pin to get that input into XTension.
  
Line 79: Line 80:
  
 ==GPIO Ratings and Safe Usage:== ==GPIO Ratings and Safe Usage:==
-The pins brought out to the screw terminals have extra protection to try to protect the CPU from excessive voltage or spikes from static but it is still definitely possible to damage or destroy the CPU by using these improperly. The aux GPIO on the expander connector may have other limitations and not support all the functionality(BETA: As of this beta version the capabilities of these are not limited in the UI so you can select functions they won’t support.)  The maximum current output per GPIO pin should be limited to 12ma and the total output from all the GPIO pins should be limited to 40ma. In reality the ESP32 seems to support quite a bit more than this without damage but if you do that you are taking your fate into your own hands. If you need to run more than a 5mm led from a GPIO pin directly you should use the GPIO to turn on a transistor or mosfet. There are many diagrams and tutorials available for safely connecting such things to an esp32 or arduino. In the case of an NPN channel mosfet no other hardware is required, in the case of a transistor a 1k or so resistor in between the GPIO output and the transistors gate is required or the transistor will burn itself out fairly quickly.+ 
 +On this module no protection is added beyond what is offered inside the chip itself. It should be robust enough to survive casual handling but will not survive a static discharge from you. It is also likely that if used on a long wire that it could be destroyed by a nearby lightning strike as those can induce a large amount of current onto such a line. If you need to use these for more than local control and monitoring please consider the GPIO module as that has extra protections addedOr use other line conditioning or control devices. 
 + 
 +The maximum current output per GPIO pin should be limited to 12ma and the total output from all the GPIO pins should be limited to 40ma. In reality the ESP32 seems to support quite a bit more than this without damage but if you do that you are taking your fate into your own hands. If you need to run more than a 5mm led from a GPIO pin directly you should use the GPIO to turn on a transistor or mosfet. There are many diagrams and tutorials available for safely connecting such things to an esp32 or arduino. In the case of an NPN channel mosfet no other hardware is required, in the case of a transistor a 1k or so resistor in between the GPIO output and the transistors gate is required or the transistor will burn itself out fairly quickly.
  
  
Line 145: Line 149:
 ===Normal Operation:=== ===Normal Operation:===
 In normal operation with a valid XTension connection the LED will be dimly lit to indicate that everything is working properly. You can configure the brightness of the LED or even set it to 0 if you do not wish the LED to be lit all the time. This setting is available on the settings web page. If the wifi drops or the connection to XTension is lost the LED will change to the appropriate state to indicate that. In normal operation with a valid XTension connection the LED will be dimly lit to indicate that everything is working properly. You can configure the brightness of the LED or even set it to 0 if you do not wish the LED to be lit all the time. This setting is available on the settings web page. If the wifi drops or the connection to XTension is lost the LED will change to the appropriate state to indicate that.
 +
 +
 +=====
 +
 +====Firmware Reset:====
 +There are 2 ways to reset the device to “factory” defaults. At any time the device is powered on and running, hold the setup button for 10 seconds. The status LED will begin to flash rapidly indicating that it is ready to reset. Release the button and the defaults will be reset and then the device will reboot into setup mode so you can reset the wifi information and other settings.
 +
 +If the devivce will not finish the boot process or continues to restart for some reason you can reset the settings during the startup sequence. 
 +
 +After resetting the device wait for the startup animation to begin fading the status LED up and down. During this animation press and hold the setup button. Do not press the setup button during the actual power on phase as this will put the device into local firmware upload mode. If this happens press the reset key and try again.
 +
 +After the startup animation completes the device will check for the setup button and if it finds you’re holding it the LED will begin to flash rapidly. Hold the setup button for about 10 seconds until the LED stops flashing and turns on at full. Release the setup button as soon as the LED stops flashing. The device will reset to defaults and reboot into setup mode.
kits/pwm.1635777412.txt.gz · Last modified: 2023/02/13 14:51 (external edit)