[PIGET] Watch your Raspberry Pi with 2b3l

[PIGET] Watch your Raspberry Pi with 2b3l

This project is unfinished !
There are probably:

  • bugs
  • things that doesn’t works
  • missing documentation
  • hazardous spell checking.

If you want to contribute , you can post your suggestions, ideas, corrections :

All comments are validated manually, so don’t worry if they don’t show up instantly.

Idea

We are going to use 2 buttons and 3 leds to:

  • See if someone have access to our terminal (red led)
  • See if file sharing is active (yellow led)
  • See if someone is currently using file sharing (green led)
  • Button 1 : Restart our Raspberry Pi
  • Button 2 : Enable / Disable file sharing

(note : if you find other ideas on how to use 3 leds and 2 buttons, you can post them on http://github.com/pigetnet/ledsButtons/issues )

3D model

2b3l en filaments phosporescent
2b3l made with phosphorescent filament

Link to 3D model:
https://github.com/pigetnet/ledsButtons/tree/master/3d

(note : This model was not properly test, if you have another 3D model idea, feel free to share them)

(note : We will explain how to solder the components here)

Wiring

Cables must make a 3×2 rectangle on the Raspberry Pi at the end.

2b3l_bb

  • Red led : 21
  • Yellow led : 20
  • Green led: 16
  • Button 1 : 26
  • Button 2 :19

https://pinout.xyz/

You can also display the pinout by typing /do/ledsButtons/pinout

Installation

To install this module, type in your terminal :

/pi/install ledsButtons

(note : Beware of the uppercase, I will modify this module to be only in lowercase later)

This will install led , buttons and supervisor.

Usage

Two modes are available :

Test Mode : This mode will check if everything is correctly wired:

Type :

/do/ledsButtons/test

Bouton 1Turn on all leds
Bouton 2 : Turn off all leds

Security Mode : This mode will check if something is connected to your Raspberry Pi

/do/ledsButtons/security

Red led :  Terminal is currently use(ssh)
Yellow led : File sharing is currently use (samba)
Green led : File sharing is enabled (samba)
Button 1 : Blink all the led , and shutdown the Raspberry Pi
Button 2 : Enable / Disable file sharing (samba)

Create your own mode :

Check this script: https://github.com/pigetnet/ledsButtons/blob/master/scripts/ssh/check
If you want to create your own services, you need to learn how to clone a module here

Commandes

Security Mode
  • Enable security (sambaCheck sshCheck)
    /do/ledsButtons/securityOn
  • Disable security
    /do/ledsButtons/securityOff (sambaCheck sshCheck)
  • Restart security
    /do/ledsButtons/securityRestart
Buttons
  • Display button 1 state
    /do/ledsButtons/button1State
  • Display button 2 state
    /do/ledsButtons/button2State
  • Display buttons and leds state
    /do/ledsButtons/state
  • Set up buttons
    /do/ledsButtons/setButtons
All leds
  • On
    /do/ledsButtons/allOn
  • Off
    /do/ledsButtons/allOff
  • Blink
    /do/ledsButtons/allBlink
  • Fade in / Fade out
    /do/ledsButtons/allPulse
Red led
  • On
    /do/ledsButtons/redOn
  • Off
    /do/ledsButtons/redOff
  • Blink
    /do/ledsButtons/redBlink
  • Fade in / Fade out
    /do/ledsButtons/redPulse
  • Display state
    /do/ledsButtons/state
Yellow led
  • On
    /do/ledsButtons/yellowOn
  • Off
    /do/ledsButtons/yellowOff
  • Blink
    /do/ledsButtons/yellowBlink
  • Display state
    /do/ledsButtons/yellowState
Green led
  • On
    /do/ledsButtons/greenOn
  • Off
    /do/ledsButtons/greenOff
  • Blink
    /do/ledsButtons/greenBlink
  • Display state
    /do/ledsButtons/greenState

Supervisor

(note : this module is undocumented and needed to be check properly: http://github.com/pigetnet/supervisor/issues)
(note : This part will be a tutorial on his own)

The supervisor module can be use to transform a software or a script as a service.
You only need to make your scripts/software run in an infinite loop.

To create a service, type:
/do/supervisor/create service_name script
/do/supervisor/create sambaCheck /do/ledsButtons/scripts/samba/check

To display a list of services:
/do/supervisor/list

To display log of a service:
/do/supervisor/log service_name
/do/supervisor/log service_name

To remove a service:
/do/supervisor/remove service_name
/do/supervisor/remove sambaCheck

To restart a service:
/do/supervisor/restart

To stop a service:
/do/supervisor/stop

To start a service:
/do/supervisor/start

Comments are closed.