Ben Simms

Tag: arduino

Brew B0y – My Arduino powered dual thermometer with counter

 BrewB0y – Arduino Powered thermometer for Homebrewing.

DSC_0111

The Plan:

I wanted to improve my homebrewing process and one part of the process requiring some attention was the constant monitoring of my beer and boiling temperatures.

I looked around for a thermometer with two probes, all I could find were food thermometer, I needed something better, something waterproof and something that could withstand temps of 90+. I couldn’t find one so I decided to make one!

The Outcome:

I was extremely pleased with the outcome, it actually worked and worked very well! The process was fairly plain sailing, as with most Arduino projects there were a number of existing libraries available so all I had to do was wire it up and create the functions I needed to make it mine.

The probes I bought were fantastic and to make life easier I could wire up multiple probes into a single port using the OneWire Library, then using a short bit of code, assign an address to each probe. This meant I could run both probes at the same time thus allowing me to keep an eye of the temperature in my mash tun while I boil up the next batch of water. I wanted a nice length so that I could run the probes around my shed without hassle and at 3meters, I had more than enough.

The first part was just getting the probes working and understanding how they worked, the next part was wiring up the LCD screen for which I used the Adafruit GFX library. After working out how to display text, this was actually a simple and fun part of the process.

Finally I tweaked and refactored some of my code to make the BrewBoy updated in a timely fashion.


DSC_0119
DSC_0109 DSC_0114 DSC_0115

Early Development Video:

https://goo.gl/photos/LoZtg522LKEUGH9P7

The Shopping List.

LCD Screen: http://www.ebay.co.uk/itm/Nokia-5110-LCD-Module-Monochrome-Display-Screen-84-x-48-for-Arduino-PIC-etc-/161258450379

Probes: (2 x 3m) http://www.ebay.co.uk/itm/111635721085?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Arduino Nano: http://www.ebay.co.uk/itm/New-Arduino-Nano-V3-0-with-CH340G-5V-16M-compatible-ATmega328P-Headers-UK-/151765624720?hash=item2355efa790

4.7k Ohm Resistor http://www.maplin.co.uk/p/metal-film-06w-47k-ohm-resistor-m4k7

The Code.

The entire project and it’s dependancies can be found on GitHub here: https://github.com/zerosimms/Brewb0y

[codesyntax lang=”php”]

#include <OneWire.h>
#include <DallasTemperature.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

//New display object.
Adafruit_PCD8544 display = Adafruit_PCD8544(12, 11, 10, 9, 8);

//Temperature Pins.
#define ONE_WIRE_BUS 3

//LCD Pins.
#define PIN_RESET 8
#define PIN_SCE   9
#define PIN_DC 10
#define PIN_SDIN  11
#define PIN_SCLK  12

//Onewire object.
OneWire oneWire(ONE_WIRE_BUS);

//Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

//Each thermometer has a unique address, this can be found with addressFinder.ino
DeviceAddress thermometer1 = { 0x28, 0xFF, 0xE3, 0x86, 0x66, 0x14, 0x03, 0x4D };
DeviceAddress thermometer2 = { 0x28, 0xFF, 0xD7, 0x76, 0x66, 0x14, 0x03, 0xA7 };

int buttonOne = 7;
int buttonState = 0;
int temperature1;
int temperature2;
int timer = 90;
int seconds = 0;
boolean startCountDown = false;

//Prints all the data to the LCD screen.
void printScreen() {
  display.setCursor(0,0);
  display.println("---BREW-B0Y---");
  display.setCursor(0,10);
  display.println("BOIL:");
  display.setCursor(32,10);
  display.print( temperature1);
  display.print("c");
  display.setCursor(0,20);
  display.println("MASH:");
  display.setCursor(32,20);
  display.print(temperature2);
  display.print("c");
  display.setCursor(0,30);
  display.print("TIME:");
  display.setCursor(32 ,30);
  display.print(timer);
  display.print("m ");
  display.print(seconds);
  display.print("s");
  display.setCursor(0,36);
  display.print("--------------");
  display.display();
  display.clearDisplay();
}

void setup(void) {
  Serial.begin(9600); 
  pinMode(buttonOne, INPUT);
  display.clearDisplay();  
  display.begin();
  display.setContrast(45);
  display.setTextSize(1);
  display.setTextColor(BLACK);

  sensors.begin();
  sensors.setResolution(thermometer1, 10);
  sensors.setResolution(thermometer2, 10);
}

//Does what it says.
void getTemperatures() {
  temperature1 = sensors.getTempC(thermometer1);
  temperature2 = sensors.getTempC(thermometer2);
}

//Check to see what state the timer is at.
void checkTimer() {
  if (timer > 0 && startCountDown){
    if (seconds >= 1){
      seconds = seconds -1; 
    }
    if (seconds == 0){
      timer = timer -1;
      seconds = 60;
    }
    if (timer <= 0){
      timer = 0;
      seconds = 0;   
    }
    delay(1000);
  }
}

void checkIfTimerStarted() {
  if (buttonState == HIGH) {
    startCountDown = true; 
  }
}

void loop(void) {
  buttonState = digitalRead(buttonOne);
  printScreen();
  getTemperatures();
  sensors.requestTemperatures();
  checkIfTimerStarted();
  checkTimer();
}

[/codesyntax]

Automated Robot Arm in conjenction with Appium and Java framework

 

Hackathon – Robot Arm for automated testing.

cukesA few years back I was at a conference where I saw a few guys displaying mobile automation using Cucumber, what made these guys stand out though from the other presenters (for me at least) was their wall. They had constructed a wall to which a number of Android Phones were mounted. They were able, through Cucumber to rotate these devices to test “real life” rotation. I thought this was great and ever since seeing it, I’ve wanted to replicate it.

A few months back I did just that, using an Arduino attached to my local computer I was able to drive a stepper motor from within the automated framework! Then, last week we were given the opportunity at Gamesys to participate in a “Hackathon”. The idea of a hackathon is to quickly knock an idea together and demo it, the only rule is that it must add some business value. This was then, the prime opportunity to take the robot arm to the next level!

So the concept was there, drive a stepper motor through our automated framework attached to our automated testindex farm. (Our test farm is a mac mini with a load of ipads/phones

WP_20131212_009

The pin map can be found in the pi4j documentation.

attached and running Appium) and it didn’t take long to recruit a few members 🙂

Initial thoughts was Arduino to drive the stepper motor but after a while we decided to go with the Raspberry Pi, the reasoning for this is that it has full on network compatibility, has

an OS and by it’s very nature is open source, so we can easily do what we want with it.

Using the noob (new out of the box) installer we quickly set up the Pi without the gui to keep things light.

 

Next was wiring in the stepper motor, we had found a nice java library (Pi4j) that played well with our stepper motor and was really well documented so all we had to do was make sure we wired in the cables to the correct pins on the board. As you can see from the photo, we only had to use six pins, one for power, one for earth and four to communicate with the steppers motor’s PCB board.

Screen Shot 2013-12-18 at 12.16.49

This was used for testing locally and is the same script we compiled and ran on the Pi.

We quickly ran some test’s and was happy to see the stepper motor light’s flash away as the motor rotated fast and smooth in both directions.

Now we had to deal with the communication between the Pi and our framework. The reason we chose Pi4j is because it’s Java and so is our framework and our thoughts were that the two would work hand in hand and they did!

Screen Shot 2013-12-18 at 12.16.40

This is the script we ran from within the framework, which makes the connection and sends the required events.

On the Pi we had to compile a little Java class that we could kick off as soon as the Pi would boot, the class would start the server running locally so that would could communicate to it from the framework, at this stage for the purpose of the hackathon we were having to hardcode some variables and is something we need to tidy up in the future. We added a few print messages so that on the demo we could “prove” to some degree that we can not only listen to events being sent, but also respond if we need to.

So now we had both parts ready, all we needed was a little test script that we could run in our framework.We added a simple loop that would make the arm rotate left and right five times.

After hitting run, it was a case of sitting back and watching the results… very satisfying!

And here it is, in all it’s glory… The Robot Arm!

 

 

 

 

 

So what did I learn personally. First of all, it’s amazing how much can be achieved without any interruptions. The two days flew by and were really enjoyable, I love hands on and I love tinkering so I was really happy to have the opportunity at work to get involved with some hardware as well as software. On the software front, there was a lot of fun to be had with the libraries, it’s great to see so many people sharing what they have done and documenting the process along the way, it sure made our life’s easier 🙂

Last but not least I want to also credit Tomasz Borys and Lewis Jardine, this was a team effort and I by no means claim to be have done this on my own 🙂

Copyright © 2017 Ben Simms

Theme by Anders NorenUp ↑