My Raspberry Pi + Arduino Project

wlanboy

Content Contributer
https://vimeo.com/87249046

So what did I build?

My servers <-> Internet <-> Rapsberry Pi <-> Arduino <-> Shiftregister <-> blinking things

  1. Cronjob running a Ruby script
    This script does:
    • Load list of ips and loop through list doing:
    • Ping ip
    • Try to login via ssh (key based)
    • Check if other sessions are open
    • Check if logfiles should be checked (logwatch report with bad words)
    • Save short status to byte array
    • Write this array to the EEPROM (512 bytes!!) of the Arduino (serial)
  2. Loop within Arduino
    • Load array of status bits
    • Loop through array
    • For each item
      Increase counter and refresh digit display (count + 1)
    • Check status of each byte
    • Enable or disable LEDs
So the digit display is showing which server status is currently displayed (0 to 9 - so 10 servers).

The 6 LEDs (red/green/red/green/yellow/yellow) do show:

  1. Ping status (red bad / green good)
  2. Service status (red bad / green good) [if every required service is running or not]
  3. Other sessions are open (yellow) [so someone is playing around]
  4. Logstatus (yellow) [Hey I should look at those log files]

I am still searching for a good 16 bit shift register (maybe the STP16C596A) and I want to add a 4x16 LCD module too.

The Raspberry Pi is able to handle the stuff too but can only work with 3.3V input/output where the Arduino can handle 5V input/output.

It is a pain to work with resistors for each single GPIO of the Raspberry Pi:

5v3v.jpg

And - of course - you save a lot of energy because the Arduino is more energy efficient.

I like the idea of separated areas of responsibility:

Raspberry Pi doing all the network and analysing stuff and Arduino doing all the electro-technics.

I toy with the idea of buying a USB hub to connect several Arduinos with one Raspberry Pi.

One Arduino for the LCD/LED stuff

One Arduino for the temperature/light/movement stuff

One Arduino for a touch button pad - each button for one action like ssh login and calling scripts, etc.

Yup your right - I am currently running riot on this electro stuff.

Edit: Added video link.
 
Last edited by a moderator:

peterw

New Member
And a short hand-shaking made video of the whole setup in action:

Videolink.
Nice setup. How do you even out the pin pulses for the shift register? I use a capacitor for this problem.

Is everthing going through the shift register or do you connect directly to the leds?

Are you using /dev/ttyUSB0 for the communication? What library do you using? I use pySerial for the communication with Arduino.
 

wlanboy

Content Contributer
  1. 250 Ohm resistor - lowering the noise.
  2. Only the digit display is controlled through the shift register, LEDs through digital pins.
  3. Yup tty through USB using the serialport gem.
 

BuyCPanel-Kevin

New Member
Verified Provider
That's actually really cool! I might have to set one up for my server to check on it, I'd definitely use an LCD over the LED's though ;)
 

peterw

New Member
If you want a easy setup take a LCD with Hitachi HD44780 driver. LiquidCrystal.h is badass.


#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
lcd.begin(16,2);
}

void loop() {
lcd.setCursor(0, 0);
lcd.print("I like Arduino");
delay(500);
lcd.setCursor(0, 1);
lcd.print("and vpsboard");
delay(500);

for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
lcd.scrollDisplayLeft();
delay(150);
}

for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
lcd.scrollDisplayRight();
delay(150);
}

lcd.clear();
}

2.486 Bytes of C magic.
 
Top