Hackers – Temperature Control, Part 1

IMG_20180929_131406

In Hackers, we started work on a short project for a temperature-controlled soldering station. As shown on the whiteboard above, the basic idea is:

  • A temperature sensor is connected to an Arduino (analog input)
  • A soldering iron, with its tip located near the sensor, is wired to the mains via a relay switch
  • The Arduino can control the relay switch to turn the soldering iron on/off
  • This is the basis for a simple bang-bang controller: we have a target temperature (e.g. 200 degrees) and a tolerance (e.g. ±10 degrees), then you turn it on if the temperature is below 190 degrees and turn it off if above 210 degrees.

We noted that since there will be space between the soldering iron tip and the temperature sensor, the temperature it will read will be lower than the tip temperature.

As the whiteboard shows, this project also involved discussion of: wiring for the thermocouple; how breadboards are wired; normally-open vs normally-closed relay switches.

One group used a LM35 temperature sensor – here are its specs, and the group found it interesting to see how detailed and useful these data sheets are: http://www.ti.com/product/LM35

The other group used a potentiometer to simulate temperature, so they could test it working over its full range, as shown here:

IMG_20180929_135713

Below is the code for reading and displaying the temperature. Next steps will be to integrate it with the relay.


// Michael Madden, CoderDojo Athenry
// Reading a temperature sensor.

// The temperature sensor is an LM35 - here are its specs: http://www.ti.com/product/LM35 
// THe temperature range is -55 to 150 degrees celcius.
// Its output voltage pin is connected to an analog input on the Arduino (A1),
// from which we read a value in the range 0-1023, so we convert them.

void setup() {
  // Just needed for print statements to work
  Serial.begin(9600);
}

void loop() {
  // Read the temperature sensor: get a value in range 0-1023
  int val = analogRead(A1);

  // From the analog input, we get a value in the range 0-1023
  // and we need to convert it to a temperature in the range -55 to 150 degrees.
  // The two lines below achieve this in differnet ways and give the same result.
  int temp1 = (val/1023.0)*205 - 55;
  int temp2 = map(val, 0, 1023, -55, 150);

  // Print out the raw value and converted temperature
  Serial.print("Sensor value = ");
  Serial.print(val);
  Serial.print("\tTemperature 1 = "); 
  Serial.print(temp1);
  Serial.print("\tTemperature 2 = ");
  Serial.println(temp2);

  // Wait 100 milliseconds before reading the sensor again
  delay(1000);
}

 

Hackers – 3D Printers and Turing Machines!

We had a small but dedicated team of Hackers for our first week back at CoderDojo Athenry last Saturday.

To begin, we started working on 3D printers. 3D printers are a fantastic technology for turning 3D computer models into physical objects. Here are Kevin’s notes on how to set up a 3D printer: 3d-printer-setup (PDF)

Here are the configuration files needed for the Materia 101: https://www.dropbox.com/s/6otj5ok7i00ikds/Slic3r-Materia101-Settings.zip?dl=0

And here also is a diagram Kevin prepared, showing the 3D printing workflow:

3d-printing-workflow

In addition to setting up software for the 3D printers on group members’ Windows and Linux machines, we started planning potential projects for this year.

One possible project is to build an 8-bit PC from individual components. It was mentioned that it’s Turing complete, which led to a discussion of some concepts that are named after Alan Turing:

Turing Complete: a computer system is Turing Complete if it has the core features that mean it can run any algorithm. For a modern programming language, this means in practice: memory (variables); decisions (if statements); repetition (loops). However, this does not consider things like how data is input and output (file handling, displays, networking, etc), those secondary capabilities are a lot of what make computers useful.

A nice flip side of Turing Completeness is that if you are learning a new programming language, and you can figure out how to handle variables, decisions and loops in that language, you have mastered all the basics!

The Turing Test is a different concept that Alan Turing came up with, when he was thinking about early concepts of Artificial Intelligence (which was impressive considering how computers barely existed!) Rather than thinking about creating computer intelligence by replicating the functions of the human brain, he imagined an experiment where a human would communicate with either another human or a computer (selected at random); in the conversation, the asker could ask whatever they liked, and the human or computer answerer could try to deceive if they wished. If the experiment is repeated and askers cannot determine accurately whether the answerer is a human or computer, we should conclude that the computer is behaving intelligently.

Incidentally, Google’s recent Duplex demo, where an AI system can phone businesses to make appointments, is arguably an example of an AI system passing the Turing test, asn the people receiving the phone calls thought they were talking to a human:

Hackers – Great Progress on Project SABRE!

Our Hackers Group at CoderDojo Athenry made great progress last week on Project SABRE (Small Autonomous Battling Robotic Entities), in which two teams (Team DJARS and Team MEASAM) are building battlebots to compete with each other.

Here is a first test of the driving and steering of one of the bots, operated via a 2.4 GHz remote control with DSM2 protocol and an LemonRX receiver interfaced with an Arduino:

(The two teams worked together on the driving/steering code, which they will share.)

Team MEASAM’s bot has a flipper weapon, and they managed to get the actuator operating via the remote control last weekend also:

Meanwhile, Team DJARS have been working on their vertical spinner/grinder, which they are now controlling via a relay switch using the remote control also:

This project is proving to be a great and engaging learning experience!

Hackers – Building Battling Bots for Project SABRE!

projectplan

In recent weeks in the Hackers group, we have been refining our plans for Project SABRE (Small Autonomous Battling Robotic Entities).

Our mission for Project SABRE is to build “battlebots” that include some autonomous features. While there are many kits available for purchase, our two teams of hackers are designing and building their bots from scratch, identifying and sourcing all components ourselves, 3D printing bodies of their own designs, and programming everything themselves. Even the mentors are hands-off, helping mainly with project planning and purchasing, but not designing or making.

The main components required are:

  • 2 or 4 motors with wheels or tracks
  • Battery packs and chargers (salvaged from old toys)
  • An Arduino
  • A motor driver board or chip — these work just like the transistor circuit that we experimented with previously, but can control up to 4 motors and drive each one forwards or backwards: https://coderdojoathenry.org/2017/11/22/hackers-a-joule-thief-and-controlling-motors/
  • A servo motor if needed for a flipper arm
  • A 2.4 GHz radio transmitter and receiver

Stay tuned as the work continues in the coming weeks!

 

Hackers – a Joule Thief and Controlling Motors

DSC_2299

In the Hackers group, people worked on two different projects, making a Joule Thief and controlling motors.

Joule Thief

A Joule Thief is a small circuit that can boost the voltage from a small power source. Typically, it is used to power a 3-volt LED from a 1.5 volt battery. Because of how it works, it can continue to light the LED even when the battery would usually be considered to be “out of power”, when its voltage drops below 1v.

Here is a Wikipedia article. https://en.wikipedia.org/wiki/Joule_thief

people in the group found various tutorials online, such as this one from Make Magazine: https://makezine.com/projects/joule-thief-battery-charger/

Motor Control with an Arduino

Continuing our work on Project SABRE, we were figuring out how to control motors.

A simple way to control the speed of a motor is to regulate its input voltage. In Arduino code, you set the output voltage of pins. However, you CANNOT just hook them up to the motor, as it will draw too much current and damage the Arduino.

The solution is to use a transistor: power from a 9V battery or the 5V USB power supply from an Arduino powers the motor with current flowing through the transistor, and we regulate the current flow by applying an appropriate voltage to the middle leg of the transistor.

Two more components are needed: a resistor for the middle leg of the transistor, and a diode to get rid of any voltage spikes that come from the motor acting as a generator if it us spun by hand, or when it is spinning down after current to it is cut.

More details here: https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/arduino-code

We also looked into stepper motors, and controlling speed by reading a value from a potentiometer, instead of just typing in a speed: https://www.arduino.cc/en/Tutorial/StepperSpeedControl

 

Brilliant Visit by Medtronic to CoderDojo Athenry!

This slideshow requires JavaScript.

We were delighted to have Medtronic visit us on 18 Nov 2017 at CoderDojo Athenry. It really was a fantastic event, and very professionally organised by Cushla, Mary and the rest of the team from Medtronic, who gave out different-coloured wrist-bands to divide our large ninjas into groups who could view the demos together.

The team set up a great range of demos:

  • A special “memory” metal they use to make stents for heart valves
  • A Smart TV/Surface Pro to allow you to see how stents work
  • VR Headsets to explore blood vessels in augmented reality 
  • Some experiments that you can try out at home, including how to make a stethoscope and how to make a valve like a heart valve.

In addition, senior software engineer Lorraine and software interns Patrick and David spoke about their experiences of being software engineers in the med-tech industry.

We are very grateful to Medtronic, and in particular our mentor Declan Fox, for organising such a great experience for our ninjas!

Hackers – Project SABRE

ProjectSABRE

In the Hackers group, we started working on design of semi-autonomous or fully-autonomous battle-bots.

We are using the name “Project SABRE” as described in the graphic above.

Members of the group took first steps in learning how to control a robot by setting up a controllable circuit for LEDs.

This should be an interesting project to return to after the break!

DSC_2258