Introduction: Self-service Bike Rental Station Notifier

Hey there !

Ever wanted to have a little object that notifies how much free spots or bikes are remaining at your closest self-service bike station ?

You are at the right place to get started !

This tutorial will use the famous Arduino IDE.

Main steps covered:

- Hardware setup

- Fetching the data from the company offering the bike self-service (in this tutorial we will use “vLille” in France - http://www.vlille.fr/)

- Streaming this data to the WiFi chip (ESP8266)

- Blinking the leds according to the data received

Step 1: Hardware

The parts are pretty easy to hook-up.

The D1 mini board uses the famous ESP8266 microcontroller WiFi integrated chip for about 5$ only.

You can buy this board at lowest price on AliExpress.

This MCU (Microcontroller Unit) allows low consumption WiFi projects to run with great performance.

More info here: https://en.wikipedia.org/wiki/ESP8266.

Instructions:

- Plug in the DATA cable of the 2 led strip (WS2812) to the pin labelled "D1" on the board.

We will use this pin in the Arduino code (#define DATA_PIN 1).

- Plug in the 5V cable to the pin labelled "5V" on the board.

- Plug in the GROUND cable to the pin labelled "G" on the board.

Step 2: Software

Now comes the more "tricky" part.

This section can be divided in two:

1. The script that will fetch the data on the self-service bike rental website.

2. The Arduino code to progam your ESP-8266.


The source code can be found on my GitHub - code. Give it a star if you like it :)

1. Web scraping the data with Python

You can get the script I wrote in the "Python" folder.

This python program is simply there to give you an idea of how to webscrap the desired bike rental service.

As I already said, this tutorial covers the service vLille in France.

This tutorial assumes you know what MQTT protocol is. I used the HiveMQ online free MQTT broker (http://www.hivemq.com/try-out/) to establish the connexions.

- Host: broker.hivemq.com

- Port: 1883

The python program gets the information we want from hereand then sends it to the MQTT broker. You can visualize the upcoming data on this page. Make sure to subscribe to the topic "notifier" (defined in "main.py").

PREREQUISITES:

- Python 3 or above (https://www.python.org/downloads/).

Python extra libraries:

sudo pip install "package"

To run the program simply execute the main.py.

sudo python3 main.py

2. Programming the ESP-8266 (D1 Mini) with Arduino IDE

PREREQUISITES:

- Latest Arduino IDE (https://www.arduino.cc/en/main/software)

- Arduino core for ESP8266 WiFi chip (https://github.com/esp8266/Arduino)

Make sure to follow the installation guide

- Libraries

- Select the board D1 mini as shown in the screenshot in Arduino "Tools".

You may now compile the code correctly.

- Power the board and you'll see a new WiFi network created (ESP_Self-service bike notifier).

- Connect to it.

- Go to 192.168.4.1 if a web page does not open by itself.

- Select your personnal home WiFi network and enter the password.

- Confirm. Now the ESP will reboot and connect to YOUR personnal home network by itself (if you entered the correct information).

- Finally, run the python program that will send the data to the broker.

The ESP-8266 will then receive the upcoming data and light the LEDs accordingly !

Color code:

0 - the LED will be RED
> 0 && <=2 - the LED will be ORANGE
> 2 && <= 5 - the LED will be BLUE
> 5 - the LED will be GREEN

Step 3: Enjoy !

Thanks for following this tutorial.

Now you'll know instantly by looking at the color how many bikes and spots are available ! Good ride !

It is a big mix of many different "notions" so please be patient ;)

Also, keep in mind I wrote this tutorial very quickly...

BONUS: If you are interested in printing a little 3D case that fits perfectly, here is the file.

Have fun and feel free to send me feedback of what you did with this !

Antoine.

Comments

author
luisomoreau (author)2017-02-06

Great tutorial Antoine!

I really appreciate the 3D printing casing bonus.

Thanks

author

Thanks Louis !
Yours are great too, love the one mixing Sigfox and OpenCV !
Cheers

author
DIY Hacks and How Tos (author)2017-02-04

This is a great first instructable. You should enter this in a few of the contests that are currently running.

author

Thank you for the support Jason ! Why not giving it a try :)

About This Instructable

1,898views

17favorites

License:

Bio: Fan of new technologies. Wants to take part in the IoT revolution.
More by Antoine de Chassey:[Airbnb] Sigfox Lock BoxSIM-LESS texting with SiPy (BLE + Sigfox)The Uber Button
Add instructable to: