Build your own bus shelter for less than 10$

I want to show you how to build your own bus shelter using some basic electronic components and a 3D printer to pack all these stuffs.

The result in a short video

GitHub repo

GitHub | Arduinobribus | @joeybronner One you cloned the repo, you have to adapt some variables of the code: the missionId and the stationId where you take your bus. Please follow the few steps below…

Step 1: Mission ID

Find the id related to the mission, in the file located under https://github.com/joeybronner/arduinobribus/tree/master/json/bus_missions.json\ Mission object looks like:

{
  "id":"100100020",
  "name":"Gare de Lyon / Gare Saint-Lazare",
  "shortName":"B20",
  "image":"b20.gif"
}

Change the sMissionId value in https://github.com/joeybronner/arduinobribus/tree/master/arduino/arduino.ino with the id of your mission.\ Example: 100100099 in my case

Step 2: Station ID

Open the following URL with your own mission ID: http://restratpws.azurewebsites.net/api/stations/ and get the id of your station.\ Station object looks like:

{
    "id":"PC3_1039_1091",
    "name":"Camille Flammarion"
}

Change the sStationId value in https://github.com/joeybronner/arduinobribus/tree/master/arduino/arduino.ino with the id of your station.\ Example: PC3_1047_1074 in my case

Step 3: Way (A/R)

The last value is the way of the bus (“a” or “r”).\ To know the way, open the following URL with your own http://restratpws.azurewebsites.net/api/directions/.\ Direction object looks like:

[
    {
        "way":"A",
        "name":"Porte Maillot"
    },
    {
        "way":"R",
        "name":"Skanderbeg"
    }
]

Change the sWay value in https://github.com/joeybronner/arduinobribus/tree/master/arduino/arduino.ino with the way you want to display.\ Example: “a” in my case

Schematics

Wemos PIN OLED PIN
5V VDD
GND GND
D5 SCK
D1 DC
D3 RES
D7 SDA
D8 CS

Components

All you need is available on AliExpress for less than 10$ (printing price included):

The printing model is available in the GitHub repo here: 3D models. You can print it using any cheap printer you want, it will be printed in less than 2 hours.

Below, the preview of the 3D model (.stl files)

GitHub

You can contribute or simply clone the repo here: https://github.com/joeybronner/arduinobribus

Plante connectée avec capteur d’humidité, écran digital et LED d’avertissement

Il y a quelques temps j’avais commandé un kit de démarrage Arduino qui contient un Arduino UNO et une quinzaine de capteurs et périphériques (température, humidité, RFID, bluetooth, LEDs, résistances, etc…) enfin bon, le kit complet pour démarrer et commencer quelques projets sympa. J’ai donc décidé d’utiliser ce qui me restait pour faire…

Le projet

Ce projet concerne donc la mise en place d’un capteur d’humidité, relié à une LED et un écran 4 digits / 7 segments. Cet ensemble permet donc d’avoir une « plante connectée » qui affiche le taux d’humidité de la terre sur l’écran et qui allume la LED rouge, synonyme d’avertissement si la terre est trop sèche : il faut arroser!

A propos de l’écran

La difficulté la plus importante que j’ai rencontré a été pour le branchement et la programmation de l’écran. Après avoir essayé plusieurs librairies sans succès, j’ai laissé tomber et je me suis tourné vers un bout de code chinois que j’ai trouvé au fin fond des résultats Google : http://www.cnblogs.com/kaixuanpisces/p/4542176.html. C’est un peu brouillon mais pour moi c’est le seul qui a fonctionné.

Connection de l’écran 4 digits / 7 segments : SH5461AS

screen_4digits_7segments_connection_SH5461AS

Premier et dernier projet que j’ai fait avec cet écran, il utilise 12 (DOUZE!) pins et c’est une vraie galère pour le faire fonctionner. Sinon, je n’utilise aucune librairie externe puisque toute la gestion de l’écran (allumage/extinction d’un segment, réinitialisation complet, etc…) est codée ci-dessous.

Le code

[javascript]
int y[8] = {1,2,3,4,5,6,7,8};
int d[4] = {12,11,10,9};

// Digital screen map
int digital[10][8] = {
{6,y[0],y[1],y[2],y[3],y[4],y[5]}, // 0
{2,y[1],y[2]}, // 1
{5,y[0],y[1],y[3],y[4],y[6]}, // 2
{5,y[0],y[1],y[2],y[3],y[6]}, // 3
{4,y[1],y[2],y[5],y[6]}, // 4
{5,y[0],y[2],y[3],y[5],y[6]}, // 5
{6,y[0],y[2],y[3],y[4],y[5],y[6]}, // 6
{3,y[0],y[1],y[2]}, // 7
{7,y[0],y[1],y[2],y[3],y[4],y[5],y[6]}, // 8
{6,y[0],y[1],y[2],y[3],y[5],y[6]} // 9
};

long n = 1;
int x = 100;
double del = 200000;

void setup()
{
// Serial init on 9600 baud
Serial.begin(9600);

pinMode(A0, INPUT); // Moisture sensor
pinMode(13, OUTPUT); // Led

// Initialize segments
for (int i=0;i<8;i++) {
pinMode(y[i],OUTPUT);
}

// Initialize digits
for(int i=0;i<4;i++) {
pinMode(d[i],OUTPUT);
}
}

void loop()
{
// Retrieve moisture sensor value
int SensorValue = analogRead(A0);
String sValue = String(SensorValue);

// Split sensor value to write specific number on digital screen
int first = sValue.substring(0, 1).toInt();
int secon = sValue.substring(1, 2).toInt();
int third = sValue.substring(2, 3).toInt();

// State: DRY
if (SensorValue < 1000 && SensorValue >= 600) {
digitalWrite(13, HIGH);
}

// State: HUMID
if (SensorValue < 600 && SensorValue >= 370) {
digitalWrite(13, LOW);
}

// State: WATER
if (SensorValue < 370) {
digitalWrite(13, LOW);
}

// Write digital screen numbers
clearLEDs();
pickDigit(2);
showDigital(first);
delayMicroseconds(del);

clearLEDs();
pickDigit(3);
showDigital(secon);
delayMicroseconds(del);

clearLEDs();
pickDigit(4);
showDigital(third);
delayMicroseconds(del);
}

/*
* This function clears all LEDs
*/
void clearLEDs(){
for(int i=0;i<8;i++) {
digitalWrite(y[i],LOW);
}
}

/*
* Select a digit (1 to 4)
*/
void pickDigit(int x){
for(int i=0;i<4;i++) { digitalWrite(d[i],HIGH); } if(x>4) {
x=4;
}
digitalWrite(d[x-1],LOW);
}

/*
* Switch ON specific segment to display the exected number
*/
void showDigital(int x){
for(int i=1;i<=digital[x][0];i++) {
digitalWrite(digital[x][i], HIGH);
}
}
[/javascript]

Pour ceux qui souhaitent contribuer ou télécharger la dernière version du code (celui-ci ne sera pas mis à jour), voilà le repository Github : https://github.com/joeybronner/moisturedigitalplant