Category Archives: Dyalog

Heat waves and computers

I am one of these people that really enjoys the weather of +30 degrees that we’ve been having recently, however today I’m not enjoying it so much. Though it’s not been a great day in terms of organisation on my part, anyway.

So first off, I got up late, by around 45 Minutes, although this didn’t make me late for work, I didn’t arrive when I would normally do so to check everything is running OK before anyone else arrives. When I did arrive, as I walked past the server room I noticed the system fans were unusually loud. I open the door and get hit by around 45 degrees of heat that had been stuffed in there over night, great, this is going to be a wonderful day. Yes we have AirCon, Yes it had died in the night, No I didn’t monitor the temperature (and have no way of monitoring the aircon). I did however, get some odd SMS messages about services flapping this morning, which at the time I just passed off as one of those oddities, that is, until I got to the office.

First things first, get as many of the servers shutdown as we can without stopping everyone from working (this actually turned out to be all of them other than the VOIP Server and switches). With fans all around the server room high up blowing air out of the room and low down pulling air in, windows and doors open around the office it started to cool a little. Unfortunately the aircon maintenance company are busy fixing other peoples aircon units, and don’t know if they’ll get out today or tomorrow, so I need to think what to do with all these servers, I can’t run them in this heat.

Temporary Server stack

Temporary Server stack

Well, There we go, the office boardroom to the rescue, with 2 aircon units in here I stacked the servers up – there’s old Ethernet cables between each server to allow air between them. This is our mail server, and 3 virtual servers, plus our monitoring server (the tower). 2 switches one for internal, one for external, and we’re running again. our file storage is still in the server room and the temperature is at about 31C now and still cooling.

First of all I’m glad I didn’t have to move all the servers, that would have been a huge pain. I am however, glad that we always keep a cold-swap switch in the office, this saved me a lot of time and annoyance. You’ll also notice an Arduino near the keyboard, This has a temperature sensor on it and is wired into the monitoring server and will SMS me if the temperature gets too high. There’s also one of these in the server room, now.

Lesson for today – Monitor your server room temperature, Seriousely!

According to the PDU graphs, the AMPS climbed rapidly from around 8:30PM last night, So I would guess this is when the fans in the systems decided it’s too hot so started turning up more and more.

Here’s a nice graph to show how the temperature has dropped since I put the temperature monitoring in the server room, note the start of this graph is 5 hours after we had been cooling the room with fans, doors & windows. The limiting factor for the server room is 1 door and no windows…

Temp GraphKeep cool people, don’t let the heat get to you, or your devices!

 

Using Dyalog APL and a Raspberry Pi to drive a robot – Part 1 (hardware)

Over the past few weeks at work, We have been working with Quick2Wire to build a robot that can be driven from Dyalog APL on a Raspberry Pi. The robot will contain a Raspberry Pi; either a model A or model B will work. We are using a model B as we have them around the office.

You can see the robot in action on the Dyalog CTO blog here: http://cto.dyalog.com/2013/04/apl-coming-to-a-robot-near-you/

The Raspberry Pi will be running Raspbian with Dyalog APL 13.2 which will be talking to an Arduino using I2C which will then talk to a motor controller. In this case we are using a L298n motor controller and an Arduino 328 Pro Mini (5v/16Mhz).

Pictures of the Arduino and motor controller are below.

Motor Controller Board

L298n motor controller

Arduino Pro Mini

Arduino Pro Mini

After soldering programming pins to the Arduino, we used an Arduino Uno without a CPU to program the Arduino Pro Mini. To do this you simple wire TX to TX, RX to RX, 5V to 5V, GND to GND and RST to RST (reset), This allows programming of the Arduino Pro Mini without the need for an FTDI cable as we already had an Arduino Uno for prototyping. For simplicity, the Arduino Pro Mini was plugged into a breadboard as there were 4 of them to be programmed.

Programming Arduino

Programming Arduino

Once the Arduino Pro Mini is programmed, the next task is to solder on the wires for power, communicating to the Raspberry Pi and communication to the motor controller. You could choose to use pin headers on the Arduino to plug devices into, I have chosen in this case to solder the wires directly to the Arduino.

Arduino Pro Mini ready to go

Arduino Pro Mini ready to go

From here you should be able to plug the boards together and you’re almost ready to go. Here is our first built up robot.

DyaBot

DyaBot

As you’re able to see here, the Pi has Wifi and we have modified a USB-mini cable to plug into the 5v regulated feed on the motor controller. This had some issues as it turns out the 5v regulator on the motor controller has a 2v drop at around 250mA and the Pi then reboots as the Pi requires around 500mA minimal with 700mA recommended (for non-overclocked Pis). I will address this later in this document.

Here is the wiring diagram for the Arduino.

Arduino Wiring

Arduino Wiring

The 6-pin header will connect to your motor controller, the 2 pin (blue/green) will connect to your Pi, there are 2 wires to connect to the +5v voltage regulator and to the common ground.

Below you can see the same layout with a cut of the Raspberry Pi pins to connect between the Arduino and Raspberry Pi.

Arduino & Raspberry Pi

Arduino & Raspberry Pi

The pins on the Raspberry Pi here are labelled to make life slightly easier.

Due to the voltage regulator on the motor controller board not being powerful enough to power the Raspberry Pi, I am currently using a 5v/3A BEC (Battery Eliminator Circuit). This is simply a 5v power regulator which has been plugged into pins 2 (+5v) and 6 (GND) of the Raspberry Pi. There is also a common ground wired from pin 14 on the Pi. Even with the BEC I am still running the Arduino from the 5v regulator on the motor controller.

Here you can see a top view of the working robot.

DyaBot ready to run

DyaBot ready to run

On the left is the Raspberry Pi, the small board next to the Pi is the Arduino, the red board next to this is our motor controller and above this is the BEC. The thick wires from the motor controller connect to our battery.

Here are the Pin connections to get the robot ready to go.

Raspberry Pi:

Pin 2 – +5v Regulated
Pin 3 – Pin A4 on Arduino
Pin 5 – Pin A5 on Arduino
Pin 6 – GND (common)
Pin 14 – GND (common)

Arduino:

Pin A4 – Pin 3 on Raspberry Pi
Pin A5 – Pin 5 on Raspberry Pi
Pin 3 – IN4 (motor controller)
Pin 4 – IN3 (motor controller)
Pin 5 – ENB (motor controller)
Pin 7 – IN2 (motor controller)
Pin 8 – IN1 (motor controller)
Pin 9 – ENA (motor controller)
VCC – +5v Regulated
GND – GND (common)
Motor Controller:
VMS – Battery input (also connected to VCC on BEC)
GND – GND (common – also connected to battery GND)
5v – N/A

There are also 2 motor connections on the motor controller, you may have to play with the direction of the wires to your motors to have the robot respond correctly and head in the correct direction.

I am currently using an 11.1v 3-cell Li-Po pack, although this is far more power than it requires it does allow me to have the robot running for most of a day without issues. If you chose to run a Li-Po pack, Please be aware of how these packs operate, if mistreated they can expand, catch fire or explode. The safest way to use these packs is a good balance charger and a low voltage warning on the battery balance leads. This will ensure the battery does not get too low.

Quick2Wire are currently working on a new motor controller that will have a higher powered 5v regulator integrated. This will mean we no longer have to use a separate 5v regulator to power the Raspberry Pi.

If you use a different motor controller than the one we are using you will have to check that the connections are correct from the Arduino.

In Part 2 we will go over some of the APL Code, and changes we had to make in order to talk to the I2C bus on the Pi.

Parts used:

Robot Chassis
Motor Controller
Arduino Pro Mini
BEC
Raspberry Pi

Resources:

http://www.raspberrypi.org
http://quick2wire.com/
http://www.arduino.cc/en/Main/ArduinoBoardProMini
http://www.andremiller.net/content/raspberry-pi-pinout-diagram