Pull-up or Pull-down

In electronic logic circuits, a pull-up resistor or pull-down resistor is a resistor used to ensure a known state for a signal (wiki).

  • Pull-up – this option enables the internal pull-up resistor. For GPIO inputs, it means that the pressed state is the LOW signal (connected to ground). This option enables the pull-up resistor for all pins on a port P0, P1, or P2. It is the main disadvantage because if you, for example, enable the internal resistor on P0.1, you enable it on P0.2 – P0.7. Therefore it adds limits for mixing different sensors on the same port.
  • Pull-down – For GPIO inputs, it means that the pressed state is the HIGH signal (connected to +3.3V via a 4700 Ohm resistor). You cannot mix pull-up or pull-down resistors on the same port.
  • External pull-up – similar to the internal pull-up resistor, but you should add it externally on your PCB. It is the main disadvantage. The main advantage, you may mix different pull-up or pull-down types on the same port. A typical resistor value is 4700 Ohm.
  • External pull-down – see notes above.

What should you select? It depends on your application and a used external sensor. For GPIO inputs, I prefer “pull-up.” For external sensors, you should look a the sensor’s datasheet for recommended schematics.

GPIO inputs

Inversed – By default, the firmware interprets the LOW state on the input pin as a pressed state of a button. If this option is enabled, the HIGH state means the pressed button.

Link – The input immediately controls the state of the corresponding output (e.g. Input 1 – Output 1). The device sends the on/off state of the output to a coordinator. Otherwise, the input is independent.

Long – The firmware detects and reports to the coordinator a long click (2000 ms). The firmware also sends the release event when a button is unpressed.

Double – The firmware detects and reports a double click (max 500 ms between clicks).

Triple – The firmware detects and reports a triple-click (max 500 ms between clicks).

Switch – an input works as a switch. Only ON (pushed) / OFF (released) states. This option works if the input is linked to the corresponding output. When the switch changes a state, the firmware immediately reports a state of the output. The output can be a virtual (i.e. assigned to any unused pin number).

Switch is On & Link is Off – in this mode, the firmware reports click and release events for an input, also for fast clicks.

Toggle – this options appears for a switch input. The switch works as a toggle button. But because the ON/OFF state can be changed via external commands, a physical button position may differ with an output state.

Note: Input 1, if it is defined as a click button, also acts as a system button and allows you to reset the device if you press and hold that button for 10 seconds. After resetting, the device start a paring process.

Zigbee cluster: ZCL_CLUSTER_ID_GEN_MULTISTATE_INPUT_BASIC
Zigbee attribute: ATTRID_IOV_BASIC_PRESENT_VALUE
Data type: UINT8 (0 – button released, 1 – single click, 2 – double click, 3 – tripple click, 4 – long press (more than 1500 ms))

GPIO outputs

Inversed – By default, the firmware sets the output pin to HIGH when a logical state is ON. You may invert that logic using this option.

Remember state – The firmware saves the output state to NVRAM and restores it after power off/on. Also, this option works for some sensors (counter, PWM)

Zigbee cluster: ZCL_CLUSTER_ID_GEN_ON_OFF
Zigbee attribute: ATTRID_ON_OFF.

Zigbee2MQTT commands

on/off – sets the output to the HIGH or LOW state
Topic: z2m/[friedly_name]/[channel]/set
Channel: l1, l2, l3 … l8
Payload: ON or OFF

read – sets the output to the HIGH or LOW state
Topic: z2m/[friedly_name]/[channel]/get/state
Channel: l1, l2, l3 … l8
Returns: The channel state {“state_[channel]”: “ON”}

trigger – sets the output to the HIGH state for N milliseconds, then resets to LOW.
Topic: z2m/[friedly_name]/[channel]/set
Channel: l1, l2, l3 … l8
Payload: {“trigger”: 5000}

interval – sets the periodic reporting interval output to N seconds. This command can be sent to any configured channel, but it will change the interval for all changes at once. The value of 0 or 65535 disables periodic reports.
Topic: z2m/[friedly_name]/[channel]/set
Channel: l1, l2, l3 … l8
Payload: {“interval”: 50}


Comments
Harvey Specter
Posted at 21:13 February 13, 2021
António
Reply
Author

Hi, an output power state to On is possible?

    Harvey Specter
    Posted at 05:46 February 14, 2021
    Owner
    Reply
    Author

    Hi, Sorry, but I didn’t understand your question.

Harvey Specter
Posted at 10:14 February 11, 2021
Alex
Reply
Author

In the firmware configuration, I should select CC2530 under Board Type? As there is no CC2531 option.

This is a general question, is the Zigbee2MQTT journal the best way to receive the reports from the CC2531? I am very new to this.

    Harvey Specter
    Posted at 10:45 February 11, 2021
    Owner
    Reply
    Author

    Usually, it is “CC2530 without an external oscillator”. But it may depend on your board.

Harvey Specter
Posted at 13:46 February 10, 2021
Alex
Reply
Author

Hi! I have a few questions. Can I indeed use your configurable firmware to flash a hex file onto a CC2531?
Further, what is the easiest way to use your configurable software to make end devices which can be used to send wireless reports of voltage(s) on the 8 input pins? Perhaps using the reliable voltage source on the chip as a “reference voltage”?

    Harvey Specter
    Posted at 03:29 February 11, 2021
    Owner
    Reply
    Author

    Hi!

    My firmware also supports CC2531. You should configure 8 input pins as ADC pins. That’s all.

Harvey Specter
Posted at 12:35 February 5, 2021
Marc
Reply
Author

Hi

I have a device with 8 Inputs and 8 Outputs. I need the inputs and outputs being independent of each other. But would still want the input state shown as ON/OFF instead of getting the action (pressed/released). Can this be done?

    Harvey Specter
    Posted at 08:53 February 6, 2021
    Owner
    Reply
    Author

    Hi. It is not possible.

Leave a Reply