Skip to content

Rotary Switch Wireling Python Tutorial

TinyCircuits Rotary Switch Wireling product photo

This Wireling features a 10 position Rotary Encoder. This board is a great choice for discrete setting adjustments and other forms of input for your project.

Technical Details

SH-7010TA Rotary Encoder Specs

  • 10 Position Switch
  • I2C Semtech SX1505 I/O Expander

    TinyDuino Power Requirements

    • Voltage: 3.0V - 5.5V 
    • Current: 1.0uA (Normal Mode).  Due to the low current, this board can be run using the TinyDuino coin cell option

    Pins Used

    • A5/SCL - I²C Serial Clock line
    • A4/SDA - I²C Serial Data line

    Dimensions

    • 16mm x 10mm (.630 inches x .393 inches)
    • Max Height (from the lower bottom of Wireling to upper top Wireling Connector): 7.50mm (0.30 inches)
    • Weight: 1 gram (.04 ounces)

    Materials

    Hardware

    Required Software


    Hardware Assembly

    Plug your Wireling into the port you plan on using! The default in the included program is port 0.

    If you want to use a different port, you just need to change the port value in the program mentioned later.


    Programming

    Install the necessary Python package:

    pip3 install tinycircuits-sx1505
    

    Then you can download (above under Software) the Rotary Wireling example:

    rotary-example.py
    # Rotary Wireling Example
    # This example will print out the numbered direction the Rotary is toggled
    # Written by: Laverena Wienclaw for TinyCircuits
    
    import tinycircuits_sx1505
    import tinycircuits_wireling
    import time
    
    wireling = tinycircuits_wireling.Wireling()
    wireling.selectPort(0)
    
    rotary = tinycircuits_sx1505.SX1505()
    
    while True:
        position = rotary.getRotaryPos()
        print("Number direction: {}".format(position)) 
        time.sleep(.5)
    
    

    Run Program

    Navigate in the terminal to the directory with the file parent to the examples folder.

    python3 rotary-example.py
    

    Once the program is running, the number the rotary is pointing to will be printed out.


    Downloads


    Contact Us

    If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

    Thanks for making with us!