Skip to main content

How to Design and Tune Your BlinkUp Circuit

Build and optimize your connected product’s BlinkUp system

This is a guide detailing a methodology to help you design and test your device’s BlinkUp™ circuit. It includes tools and methods for selecting gain resistor values for optimal BlinkUp performance based on your product’s mechanical, industrial and electrical design.

What is BlinkUp?

BlinkUp is a patented method used for communicating WiFi and device-registration credentials optically from an iOS or Android device to an imp-enabled product. BlinkUp comes in two varieties: Bi-level and Tri-level. As their names imply, Bi-level is a two-signal waveform and Tri-level is a three-level signal.


 

At the start of any BlinkUp waveform a ‘Sync’ signal establishes parameters required to interpret data from the signal. As you can see in the chart above, the Bi-level sync phase comprises a series of flashes from the mobile device’s screen at maximum and minimum brightness. All of the peaks and troughs are averaged together to determine the mid-point of the signal. During the ‘Data’ portion of the signal, any value above the mid-point is considered a logic high. Any value under the mid-point is considered a logic low.

Bi-level signals work for the vast majority of iOS and Android devices running BlinkUp. On iOS frame rate is fixed to 60fps. However, due to a number of factors, some Android devices may not be able to support a constant 60fps. This can interfere with bi-level BlinkUp. Two approaches were devised to address this. The first is a reduced frame rate BlinkUp waveform called ‘Legacy Mode’. The second, Tri-Level BlinkUp, was developed to be a more robust solution.


 

Tri-level BlinkUp also has a Sync phase, but it is used to establish boundaries that define ‘White’, ‘Gray’ and ‘Black’ brightness levels. The sync signal produced by an Android device is a percentage of the device’s maximum brightness. The following formulas are used to calculate the boundaries:

  • White Level > Sync Max + 0.2 * (Sync Max – Sync Min)
  • White Level > Gray Level > (Sync Max + Sync Min) / 2
  • Black Level < Gray Level

Logic Levels are determined by the following rules:

  • Logic High (1) is determined by a Black signal followed by a Gray signal.
  • Logic Low (0) is determined by a Black signal followed by a White signal.

Using Black-to-Gray and Black-to-White transitions is more reliable on Android devices that do not have reliable frame rates. If a frame is dropped the signal simply gets stretched. Tri-level easily handles this as it’s the transition from Black to White (or to Gray) that denotes a bit value, not the time spent at a high or low value.

Tri-level BlinkUp was introduced to the imp OS with Release 27, which debuted in November 2013. Any imp cards and modules produced before this date will not support Tri-level until they have been updated to the current version of the imp OS. For Android users, this means that if standard Bi-level BlinkUp does not prove successful with their smartphone or tablet, they will need to use Legacy Mode. This will allow the imp to be configured, to get online and to download the latest imp OS release. This, in turn, will ensure that future BlinkUp operations will run more quickly and more reliably.

Important Considerations for Production BlinkUp

There are some factors to consider during the development of your imp enabled product:

  • BlinkUp must be tested and tuned in production enclosures to allow designers to select proper gain resistor values.

  • BlinkUp must be tested with a variety of mobile devices (Android and iOS; smartphone and tablet) in both ideal and non-ideal lighting conditions:

    • Ideal lighting conditions This depends on your application. If your product will be used in the home it is important to test your device in an environment that best represents your expected user experience. In this case ‘ideal’ could mean indoors with incandescent lamps on a nightstand. This is up to you to define.
    • Worst-case lighting conditions These are the poorest lighting conditions you want to support. This could be an open window with sunlight shining directly onto the nightstand.

When carrying out your experiments it is recommended that they are conducted in controlled lighting environments. This will ensure data collected in your trials will be consistent across time of day and other factors that affect the lighting conditions in your work environment. For more information on tuning procedures, see ‘Tools for Measuring BlinkUp Performance’ below.

The BlinkUp Circuit


R1 will require tuning to attain proper OPTO_IN
signal swing for a given mechanical design

 

As indicated in the diagram above, R1 must be chosen based on phototransistor selection, mechanical and environmental factors:

  • Phototransistors are not created equal Every phototransistor has many characteristics that affect the signal it produces, including size, lens type and frequency response.

  • Mechanical and industrial design Lenses, light pipes and location of the phototransistor all affect the incoming light seen by the phototransistor.

  • Gain resistor Once the above factors are fixed the gain resistor can easily be changed to optimize the BlinkUp signal.

Gain Resistor Values

As noted in the above schematic above, R1 will require tuning to attain proper signal levels for your application. We suggest testing the following values in your design: 68kΩ, 100kΩ and 150kΩ. The higher the value, the larger the signal swing generated by Q1. We recommend starting with a 22kΩ resistor and working your way up if necessary.


 

Observations:

  • In this case, the 100kΩ waveform is clipping on the white values. In a trilevel test, the difference between white and gray will not be sufficient for reliable operation. Furthermore, any additional ambient light will raise the amplitude of the entire signal and clip gray values as well. This is not a usable signal.

  • The 68kΩ waveform is better; this signal uses the full range of the receiver without saturating. However, if this test was conducted in ideal conditions, this receiver may be susceptible to saturation and failure in brighter-than-ideal conditions. If this is the case, a slight decrease may be advisable.

  • The 22kΩ waveform shows signal swing which may be sufficient, but just barely. BlinkUp requires approximately 15% of full-scale swing to operate. Dimmer phones or BlinkUp from a slightly greater distance may cause BlinkUp to fail with this tuning.

Let's examine a good tuning result:


 

What makes this waveform ideal?

  • Black-to-Gray swing around 33% Your Android Tri-level sync signal (Gray) should have about 33%. This will ensure ample headroom for ambient light pollution which can cause a positive DC offset in the signal.

  • Black-to-White swing of around 67% Tri-level White signal or bi-level White should have a swing of around 67%. This ensures good Bi-level performance under most lighting conditions.

Phototransistors

Phototransistors come in many varieties and have a wide range of characteristics. The following graph illustrates this:


 

This is a comparison of a Tri-level BlinkUp signal presented to two different phototransistors. The gain resistor is 68KΩ in both cases. Note how Phototransistor 2 is producing a much larger signal swing than Phototransistor 1. At 68KΩ we see the white level is clipped on the Phototransistor 2, so the gain resistor should be reduced.

Tools for Measuring BlinkUp Performance

The BlinkUp™ Tuning Utility is a piece of software that is run on your device to test the BlinkUp performance of your current hardware. It reads the signal from your BlinkUp circuit and presents the results as a chart you can view using a web browser.

The utility is available on GitHub. Copy the code from the /examples directory and paste it into new application firmware.

Once you've copied and run the code on your device under test, click on the Agent URL in the impCentral to open the utility's simple web interface in your browser, and click the "start" button on the web app to run a collection. The results will be displayed in the web app automatically when the collection is finished.

When conducting your tests, it is advisable to take your surroundings into account. If you conduct tests by a window (or co-worker’s desk lamp) your tests may be affected by the time of day or weather conditions. Therefore it is recommended that you conduct a series of test under controlled lighting that simulate the intended use of your product.

A ‘Dark Box’ is an enclosure that blocks out all light. It can be a useful tool for testing your device across a range of variables (resistance values, phones, casing modifications, etc). A simple cardboard box or photographic dark room are also viable options. Tuning results obtained with a dark box should not be treated as your final tuning values, as a Dark Box does not represent real-world conditions for most applications.


A typical custom-made Dark Box enclosure for BlinkUp testing
 

Method for Testing Your Device

It is important to test your device in a particular order to successfully arrive at a good gain resistor value.

  1. Establish a baseline:

    • Populate your gain resistor footprint with a 22KΩ resistor.
    • Place the production candidate in a Dark Box and collect BlinkUp data using the BlinkUp™ Tuning Utility.
    • Inspect the data. If you see an ideal waveform as shown above. If your sync value significantly exceeds 1V (for Android Tri-level) or 2V (iOS Bi-level) repeat these three sub-steps with a lower-value resistor. If your sync value is significantly less than 1V repeat these three sub-steps with a higher-value resistor.
       
  2. Test your product under normal lighting conditions. If your product is primarily used indoors normal could be incandescent lighting, natural light, etc. You should see your ideal waveform shift up. If your waveforms are clipped you may need to refine your mechanical design to block ambient light from reaching the phototransistor. If your waveform is still viable proceed to step three.

  3. Test your product under extreme lighting conditions. Typical conditions are direct sunlight, bright overhead lighting (especially in incandescent and halogen), etc. Your waveform should be shifted up but still meet the criteria for well defined waveform. If not you may need to make modifications to your mechanical design.