Smart Bike Lights (Data Field) / Bike Lights Control (Widget)

I've made two open source CIQ applications to control ANT+ lights:

- Smart Bike Lights (data field): https://apps.garmin.com/en-US/apps/0d9fd828-c932-4470-9c37-fd2828881888 

      Configurator: https://maca88.github.io/SmartBikeLights/ 

- Bike Lights Control (widget): https://apps.garmin.com/en-US/apps/fa3c2332-76e3-4ba1-8528-32a0fd617ab1 

     Configurator: https://maca88.github.io/BikeLightsControl/ 

Smart Bike Lights features:
- Automatic light control (Smart mode) based on the configured filters (sunset, sunlight, speed, ...)
- Manual light control (only for Edge devices with a touch screen or devices with CIQ 3.2 and more than 32KB memory)
- Records lights modes that are displayed in Garmin Connect

Bike Lights Control features:
- Manual light control (available to all devices)

Both applications can be installed on the same device, which can be useful for low end devices (e.g. Edge 520) where "Bike Lights Control" can be used to change light modes manually and "Smart Bike Lights" for automatic light control.

Currently registered ANT+ lights:
- Bontrager Ion Pro RT
- Bontrager Ion 200 RT
- Bontrager Flare RT
- Garmin Varia RTL500
- Garmin Varia RTL510
- Garmin Varia RTL515
- Garmin Varia HL500
- Garmin Varia UT800

in case your ANT+ light is not on the list you can help by doing the following:

1. Install Bike Lights Control
2. Pair your bike light with your Garmin device
3. Open the widget:
- Edge with a touch screen: post which numbers are displayed on the buttons and what mode each button represents when pressed
- Other devices: Select the "Light modes" menu and post which numbers are displayed in the menu and what mode each menu item represents when selected

Example for Bontrager Ion Pro RT:


1 -> High steady beam
2 -> Medium steady beam
5 -> Low steady beam
63 -> Day flash
62 -> Night flash

There are some features that could be possible to add in the future, but would require Garmin to add them to the CIQ api. In case you are interested in any of the below features, consider upvoting their feature request thread:

1. Control lights based on the ambient light sensor available on some devices:
https://forums.garmin.com/developer/connect-iq/i/bug-reports/ambient-light-sensor-api-access 

  • Hi Jan,

    However, I noticed sometimes strange variations in speed value, especially in places with obstructed sky view

    That seems strange to me as ANT connections should not be affected in places with obstructed sky view. Did you try to log the speed sensor data to see whether the connection is really the issue and not some Garmin firmware issue regarding the speed display? You can log the speed sensor data by using BikeSpeedListener class.

    It seems that while individual network is used the communication with speed sensor is negatively influenced, but not destroyed completely

    The only thing that comes to mind is that the additional ANT channel used by the individual network (one per light) may be too much for your Garmin device to handle when combined with the speed sensor. Regarding collisions, from the ANT documentation it states:

    When a master node opens a synchronous channel, the master node will first open a search window to check that its transmission is not likely to interfere with the transmission of another device, and will then transmit messages at the designated channel period (Tch)

    In your case the Garmin device acts as a "slave node" for both lights and the speed sensor so in theory if the master nodes (lights and speed sensor) do not interfere with each other and they have a different channel id (Transmission Type, Device Type and Device Number) there shouldn't be any collision. I don't have any practical experiences regarding the issues that you have so unfortunately I can only guess what could be the issue.

  • Yes, the speed variations in places with obstructed view of sky have nothing to do with ANT communication itself, it just pointed me that Garmin probably defaulted to use GPS speed (which is unstable if GPS signal is bad or if there are reflections from rocks, buildings etc.) instead of ANT sensor speed. This way I realized that there is some problem with communication with the speed sensor.

    The radio link is multi-master, so there must be some method how to avoid collisions. It can be e.g. time multiplexing (but then it needs some synchronization) or some kind of modulation like OFDM, which natively support sharing of single radio channel by multiple nodes. But this is quite sophisticated method for such a simple thing like ANT. So I rather expect time multiplexing to be in place but how the synchronization is done is a big question... Or maybe there is no synchronization and the whole system is robust enough to survive certain amount of collisions.... until one will try to use two independent channels for two lights.. this may somehow cause exceeding to the "acceptable limit" ;-)

    I am now trying to "gather mental resources" ;-) and if I succeed then I will dig into the ANT documentation and try to understand how the radio link is synchronized or how multiple access is solved there. I will definitely come back if I have some new idea.

  • Thank you. That worked, I'm now on v0.13.0. and have added the new code line.

    Can you please explain about this: "update the existing configuration by checking "Force Smart mode" in the light configuration"?

    I can't find it in the menus.

    Thanks.

  • It's an option in the configuration utility, which forces the light to use smart mode, but looks like it also means you can't then set it to Manual or Network

  • Can you please explain about this: "update the existing configuration by checking "Force Smart mode" in the light configuration"?

    I meant Lights Configurator, when you select the light in the configurator you will see "Force Smart mode" setting.

  • but looks like it also means you can't then set it to Manual or Network

    Yes you still can change it to Manual or Network by using the menu (e.g. Edge 530) or the light panel (e.g. Edge 1030) as such changes are not treated as external changes. The "Force Smart mode" setting will only prevent the mode to be changed when an external change happens (e.g. switching modes with the button on the light or a remote control like Bontrager Transmitr).

  • Hello. I have an 830 and I want varia 510 to start when it detects the car behind me, and when the car passes me, the light will go out?

  • Hi,

    you can use the following configuration:

    ###0,73404416#2,2|CAR:1:7:1I]-1]0|:1:0:1D=1##5,4:Varia 510|2,:-1,Off:0|1,Solid:4|1,Day Flash:7|1,Night Flash:6#0::#0:0#B3122##2#0#0

    the light will go to "Day Flash" when a vehicle will be behind you and it will be turned off otherwise. You can configure the above configuration in the Lights Configurator in case you want a different light mode or add some additional filters.

  • Ah I understand. That's great I might try that one out