Introduction: Bright Cycle Introduction
This project was created as an entry for the ChinaUS Young Maker competition and contains features that assume a familiarity with electronics circuit design, embedded programming, mobile app development, and web development.
The goal of the project is to encourage cycling, which has health and fitness as well as the environmental benefits, by improving bicycle safety, particularly when riding at night. The system includes a headlight with an internet connected module in communication with a website and mobile app.
The headlight is made up up an array of narrow field LEDs, aligned at various angles and a corresponding array of photodetectors. When light is directed at one or more photodetector, the corresponding LEDs are dimmed preventing light from being directed at the source. This allows for a very bright headlight with a wide view angle without the dangers caused by blinding others. The internet connected module takes information such a bike metrics and crash data and sends it to a cloud database. The information is then displayed on a map, to identify where and when people are riding or crashing most often. Additionally, a mobile app may be used to send cycling data to the database as well. Overall, the system improves bicycle safety for the individual user by allowing a brighter headlight that provides increased visibility when riding at night, and for the community by allowing others to identify hazardous locations to decide where improvements might be needed.
Step 1: Build the Auto Dimming Headlight Circuit
The diagram above provides an example of how to build an auto dimming headlight for the Bright Cycle system. A photoresistor is placed parallel to an array of LEDs in series with an npn transistor. As light is directed at the photoresistor, its resistance increases until the voltage drops below the threshold of the transistor and the LEDs are switched off. A potentiometer is used to calibrate the light threshold.
Step 2: Configure the Headlight
When selecting components, be sure to use LEDs with a narrow view angle. The receiving angle of the photoresistors can be reduced by placing each at the base of a short piece of heat shrink tube and then shrinking the base. To produce the desired effect, position groups of LEDs inline with their controlling photodetector, and angle each group relative to one another based on the view angle of the LEDs used.
Step 3: Connect Your Device to a Network
This feature requires a internet connected board and a server to receive data send by the device. In this example, a CC3200 LaunchPad board is connected to AT&T's M2X data network through a wireless connection. For practical purposes a GSM module should be used to connect to a cell phone network, but for testing, a wireless internet connection provides a free alternative to purchasing a data plan. To set up an M2X database, visit m2x.att.com and follow the instructions for creating an account and adding a device. Follow the instructions for adding a stream and add in the appropriate names and credentials when programming your device.
Step 4: Connect to a Mobile App
In the previous step, bicycle safety information from all Bright Cycle headlight units is stored in a database, providing a useful set of data, accessible to other applications. However, the information is limited to data from cyclist who have and are running the headlight unit. Adding a mobile application provides an alternative method for gathering information and sending it to the same database used to collect headlight unit data. To do this using M2X, add another device to your account, which will then provide credentials for connecting to the database from a mobile app.
Code for the Sight Cycle android app can be found here: Sight Cycle Android Code
Step 5: Display the Data You've Collected
Now, if both of the features from the previous two steps are complete, there will be a database full of data from all connected headlight units and mobile apps in use. The next step is to access that data through and display it in a meaningful way. If using M2X or a similar database, all data can be accessed by a web or mobile application through API calls. In the example a website is build using node, which displays a list of all of the crash data gathered and uses the locations reported to display each fall on a map.
Code for the Sight Cycle website can be found here: Sight Cycle Website Code