element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Enchanted Objects
  • Challenges & Projects
  • Design Challenges
  • Enchanted Objects
  • More
  • Cancel
Enchanted Objects
Blog Generating a Mysterious Signal
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: crjeder
  • Date Created: 7 Jun 2015 10:23 PM Date Created
  • Views 3540 views
  • Likes 4 likes
  • Comments 46 comments
  • smart_key_hooks
  • enchanted_objects
  • bit_banging
Related
Recommended

Generating a Mysterious Signal

crjeder
crjeder
7 Jun 2015

Let us assume that I want to create a signal like this:

 

image

Where:

 

Signal

Name

Duration in

μs ± 150 ns

T0H0.4
T1H0.8
T0L0.85
T1L0.45
Treset> 50

 

The usual way to generate arbitrary signals is called "Bit banging". It requires software to set the output in the "HIGH" and "LOW" state in the exact timing given by the protocol. The timing requirements for this signal look pretty strict that I do not believe that this would be possible or at least not very reliable. So I am looking for some hardware support.

After a lot of head ache and reading datasheets the idea of using the PWM came into my mind.

Bit Banging with PWM

 

Let's look at the signal again:

  • it starts always with "HIGH" and ends with "LOW" (except for reset which is always "LOW")
  • length of signal is 1.25 μs (reset again an exception)
  • 0.05 μs resolution (0.05 is the greatest common divisor of 1.25, 0.4, 0.85 and 0.45)

 

Exact Solution

The signal can be generated with PWM of 1/0.05 μs = 20 MHz frequency. Therefore the "alphabet" above translates to:

 

SymbolDuty %
"0"32
"1"64

 

The PWM frequency of 20 MHz is quite high, can the signal be done approximated with lower frequency?

 

Reasonable Approximation

The odd thing about the spec for this signal is that it is not symmetric, i. E. the high time for "0" is not equal to the low time for "1" as I had expected. Since the rising edge of the signal is every 1.25 μs this allows the receiver to synchronize. The sampling presumably takes place at exactly the half of the time which explains the asymmetry: It gives a safety margin for the timing or rather does not require steep edges.

The tolerance for the falling edge is quite high. I did not recognize it at first sight, but when I converted the whole timing into nano seconds (ns) It's pretty clear:

 

Signal Name

Time of Falling Edge

Nominal [ns]

Time of Falling Edge

Minimal [ns]

Time of Falling Edge

Maximal [ns]

T0H400350550
T1H800650950

 

This allows a much more reasonable approach:

Divide the 125 ns in three sections ad vary the duty cycle between 1/3 and 2/3 or in decimal:

 

SymbolDuty %
"0"33
"1"66

 

The frequency in this case is only 2.4 MHz. That's much better!

 

Reset

 

The reset symbol is an exception - it does not fit in the above timing. It can be generated by 40 periods with a duty cycle of 0%.

Since we are able to generate the signal there is only one question left: What is this for?

 

Usage of the Signal

 

Did you recognize / guess the signal? What do you think it is for? image

 

(solution in the next blog post)

  • Sign in to reply

Top Comments

  • crjeder
    crjeder over 10 years ago in reply to balearicdynamics +3
    Yes, the quiz with you guys balearicdynamics , mcb1 , clem57 and Workshopshed was a lot of fun! Thank you for participating!
  • Workshopshed
    Workshopshed over 10 years ago +2
    Will there be a small flower dancing along to the music?
  • mcb1
    mcb1 over 10 years ago in reply to crjeder +2
    It's been a very interesting trip back down memory lane... Looking at this sheet for WS2812B it says single NRZ protocol http://www.seeedstudio.com/document/pdf/WS2812B%20Datasheet.pdf There is some interesting…
Parents
  • crjeder
    crjeder over 10 years ago

    And we have a winner to this "Guess the Mysterious Signal" mini-callenge:

     

    Congratulations to clem57!

     

    He mailed me the correct answer 5 hours ago!

    It is a WS2812B RGB LED with integrated controller.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to crjeder

    I had not understood that you was asking for the exact component name ... Then, I am sorry I have delayed (maybe I find a way to kill clem57 with some strange frequency in attach to a mail) but I spent half of the day outside under the sun. Today we decided to posticipate the daily work some hours image So, my compliments to the winner !

     

    Enrico

     

    P.S. By the way crjeder, as mentioned in the datasheet of the WS2812B RGB LED:

    The data transfer protocol use single NZR communication mode. After the pixel power-on reset, the DIN

    port receive data from controller, the first pixel collect initial 24bit data then sent to the internal data latch,

     

    The NZR communication mode (that means Non Zero Return code) is one of the applications of the mentioned Manchester code are you can read on Wikipedia.

     

    Cheers, Enrico.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to balearicdynamics

    NRZ is an encoding technique used for communications to prevent dropped bits on noisy lines.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to clem57

    Hi Clem,

     

    I see, that's almost the reason that all these protocols communication family has been invented. Anyway it is a great thing I have never used. Not yet image

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • crjeder
    crjeder over 10 years ago in reply to balearicdynamics

    Encoding and physical representation of signals are two different things. I am no expert here, but from what I understand Manchester goes into the "encoding" category where NRZ falls into the other. The reason for Manchester Code is to ensure a transition in every clock period to facilitate "self-clocking". NRZ on the other hand uses + 2.5 V and - 2.5 V as high and low for example to ensure that there always is an non-zero DC component in the signal which using + 5 V and 0 V would imply. Therefore more power is transmitted via NRZ which facilitates noise immunity among other positive effects.

    Just to show why I do not believe that the Mystery Signal is a Manchester Code I have drawn a image:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to crjeder

    That's correct, you mean that Manchester is symmetric. But in this case also NRZ - as described in the component you used data sheet - has the same characteristics. Maybe a Pulse duration encoding communication protocol and the NRZ mention is a mistake ?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 10 years ago in reply to crjeder

    It's been a very interesting trip back down memory lane...

     

    Looking at this sheet for WS2812B it says single NRZ protocol

    http://www.seeedstudio.com/document/pdf/WS2812B%20Datasheet.pdf

    image

     

    There is some interesting notes here

    https://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/

     

     

    Adafruit seem to have a library to allow it on a Raspberry Pi ...not sure if that is any use.

    https://learn.adafruit.com/neopixels-on-raspberry-pi/overview

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • mcb1
    mcb1 over 10 years ago in reply to crjeder

    It's been a very interesting trip back down memory lane...

     

    Looking at this sheet for WS2812B it says single NRZ protocol

    http://www.seeedstudio.com/document/pdf/WS2812B%20Datasheet.pdf

    image

     

    There is some interesting notes here

    https://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/

     

     

    Adafruit seem to have a library to allow it on a Raspberry Pi ...not sure if that is any use.

    https://learn.adafruit.com/neopixels-on-raspberry-pi/overview

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • crjeder
    crjeder over 10 years ago in reply to mcb1

    Thanks Mark,

     

    intresting links.

    I have my code almost ready and hopefully I can try it today.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 10 years ago in reply to mcb1

    mcb1,

     

    supposing that the producer maybe, but it is very difficult, put a so macroscopic mistake mentioning the wrong protocol, I have the suspect that this asymmetric mechanism is just a mode to encode NRZ in a slight different way than the traditional standard. The logic deduction is also that the producer document so in depth the protocol only if this is a non-standard but a variant, else simply mention the adopted communication method and don't spend too many pages explaining it.

     

    Maybe ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube