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:

CoderDojo Athenry Information Session, Sept 2018

Slide2

Thanks to everybody who came along for our information session last Saturday the 15th September 2018.

Michael introduced us to the CoderDojo movement and spoke about CoderDojo Athenry and what we have planned for 2018/2019. His slides are here: CoderDojoAthenry-InfoSession-2018-Sept (PDF).

Martha then spoke about our shop, where we sell tea/coffee with biscuits for €2.00 or €1.50 if you bring your own cup, with all profits going towards equipment etc. for our CoderDojo.

Julie then talked about our loaner laptops where we provide laptops for people who don’t have their own. Speak to Julie or any of the mentors for more information.

Slide13

This year, we have 5 different rooms with different topics in them, for different levels of experience and age.

Explorers- led by Martha for Beginners from around age seven. Here are Martha’s slides CDA-WeeK_01_Information Session.

Advancers- led by Oliver for kids who have already been through Explorers. Here are Oliver’s slides Advancers2018.

Creators- led by Kieran and Mark for older kids who have been through Explorers and Advancers or have other coding experience. Here are Kieran and Mark’s slides Creators-2018-Intro.

Bodgers- Led by Declan also for older kids who have also been through Explorers and Advancers or have other coding experience. Here are Declan’s slides bodgers_introduction.

Hackers- led by Michael for older teenagers who have been through Creators and Bodgers. Here are Michael’s slides Hackers-Intro

You can find more on the About page of this website: https://coderdojoathenry.org/about/  and our schedule for 2018/2019 at https://coderdojoathenry.org/schedule/

We look forward to you joining us!

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!

Deadline for Registering for Coolest Projects 2018 is 25 March

Coolest-Projects-large.png

25 March 2018 is the deadline if you would like to enter Coolest Projects, which will take place in Dublin on 26 May. You can find out information and register here: http://coolestprojects.org/

We have had lots of great participation from CoderDojo Athenry at Coolest Projects in the past few years, from our youngest members to our oldest, in all of our groups. People who enter find it a fun and rewarding day.

Here is a presentation from 2 years ago about entering:

https://coderdojoathenry.org/2016/03/03/information-about-coolest-projects-2016/

Hackers – Remote Controls for Our Bots!

Remotecontrols

In the Hackers group this week, we took a large step forward in our Project SABRE (Small Autonomous Battling Robotic Entities), when we started working with remote controllers for our robots.

Components

From what the group has read, it looks like the most widely-used controllers are Spektrum-compatible DSMX or DSM2 ones. Therefore, we bought 3x Lemon RX DSMX/DSM2 receivers and one MLP4DSM Blade transmitter (as shown in the photo).

Connecting to the Arduino

Pins on the receiver are simply connected to digital pins on the Arduino.

To program the Arduino to read the receiver, this code has been cross-referenced from other forums: https://www.sparkfun.com/tutorials/348

According to the comments, while this works, you should use interrupt-driven code.

This StackExchange post has a good list of possible references:

https://robotics.stackexchange.com/questions/1207/read-multiple-channels-of-rx-tx-with-arduino

There was a lot of excitement when people were able move the joystick on the transmitter and have it change the value being printed out in the Arduino console!

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