Modellers – Week 5

Hi folks, thanks again for another fun session.

This week we continued our sword model. We finished the blade and started work on the guard.

We didn’t introduce any new concepts this week, but we did make our first practical use of the mirror modifier to allow us to create one side of the sword guard and have the other side created automatically.

Here are the video instructions from this week:

 

The matching model file can be downloaded from here.

Hackers – Basic Arduino inputs and outputs

Rheostat_bb

This week in the Hackers group at CoderDojo Athenry, we built on last week’s work on blinky lights, in which we made a simple circuit involving LEDs and resistors connected to an Arduino, and wrote code to get the LEDs to blink.

An LED is an example of an output from our microcontroller. We would also like to have inputs. Examples of circuit inputs are:

  • Switches
  • Dials
  • Sensors that measure something

We focused on dials, specifically a variable resistor or rheostat. This is the kind of knob or dial you find on dimmer switches, volume controls on old radios, electric guitars, and many others.

A variable resistor has 3 connectors: the two outer ones connect across a voltage source (e.g. 5V and ground pins on the Ardiuno) and the voltage at the middle pin can be adjusted from 0 to 5V by turning the knob.

We connected the middle pin of the variable resistor to Analog input 2 of the Arduino. The connections are shown above.

Then, the code to read its value is:

potValue = analogRead(potPin);

where potValue and potPin are ints that were defined already.

The value that you get is in the range 0-1024, and changes as you turn the dial.

Here is a full Arduino program to read a value and display it on the Serial Monitor window if you have a computer connected to your Arduino:

int potPin = 2;    // select the input pin for the potentiometer
int potValue = 0;  // value to read from potentiometer

void setup() {
  Serial.begin(9600);  // need for print commands later
}

void loop() {
  potValue = analogRead(potPin);    // read the value from the sensor
  Serial.println(potValue);
}

In the group, we used this as the basis to improve last week’s program. This time, the speed at which the LED blinks is controlled by turning the potentiometer dial.

The previous code to control how long the LED blinks for was:

delay(one_second);

We changed this to:

delay(potValue);

Of course, we also had to add the code to read the potentiometer value at the top of the loop() function.

Modellers – Week 4

Hi Folks, this week we started to model a sword using the sword found here as inspiration.

This what the sword should look like when we’re finished

We got 85% of the way through modelling the blade this week. Next week we’ll finish the blade and construct the guard, handle and pommel. These should prove considerably easier than the blade which is the most complex part.

I’ve made a video version of the building of the blade, in so far as we got it to this week:

If anyone would like my Blender file with the part-completed blade, it can be found here.

Modellers – Week 3

This week we quickly introduced a number of techniques and then had an open session where people were free to create their own projects. Our lead mentor Declan got some video showing a few of the projects in progress:

Super work from everyone!

 

CoderDojo Boo

If anyone is interested in entering the CoderDojo Boo Challenge with one of their Halloween themed Blender creations, the link to enter can be found is here:

https://coderdojo.com/2019/10/01/show-us-what-boo-can-do-its-the-coderdojo-boo-challenge/

Best of luck!

 

Mirror Modifiers

The mirror modifier saves us time when working on a symmetrical model (that is, a model that is a mirror image of itself across the X, Y or Z axis).

 

3D Cursor and Adding New Meshes in Edit Mode

The 3D cursor is the point in our scene where new content is added. We can move the 3D cursor easily by selecting one or more parts of the model, pressing SHIFT-S and then choosing “Cursor to Selection”. If more than one thing is selected, the cursor will be in the middle of the selection.

 

Adding a Reference Image

A reference image can be very useful when modelling. One can be inserted from the Add menu (look for Image|Reference). It is a good idea to untick “Align to View” most of the time. You can rotate the image to the orientation you want, or move it and/or scale it once it’s imported.

 

Modellers – Week 2

Hi folks, thanks for another great session on Saturday.

This week we looked at going beyond the object level and actually editing object meshes. With an object selected you can switch into edit mode by using the drop-down list on the upper left-hand side of the 3D viewport or, more commonly, by pressing the TAB key.

Meshes are made up of three parts:

  1. Vertices: I tend to also call them nodes, as I did in the diagram below. The represent a point in space
  2. Edges: A line between two vertices
  3. Faces: A flat solid area bounded by three or more edges (normally four in Blender)

Screenshot 2019-10-01 at 09.33.35.png

Faces are also known as polygons. Ones with three sides are called tris (short for triangles), ones with four sides are called quads and ones with more sides are called N-gons. The ends of Blender’s standard cylinder object are examples of N-gons. N-gons can cause strange shading effects when using smooth shading and we try to generally avoid or minimise them.

Editing at the mesh level

Once editing the mesh, all the usual tools that we had available at the object level (namely Move (or Grab), Rotate and Scale) can be used, but now on vertices, edges and faces.

You can work with vertices, edges or faces, as suits what you’re trying to do. To indicate which you want to use, use the buttons towards the top-left of the 3D viewport or the handy shortcut buttons 1, 2 and 3.

Adding geometry

The standard cube is too simple to start shaping We saw three ways to add geometry:

  • Adding edge loops: An edge loop is a cut that runs cleanly all the way around the object. They are easily added using CTRL-R and then using the scroll wheel to adjust the number of cuts and moving the mouse to indicate which edge you want them to go through.

  • Extruding. Select a face and hit the E key, you can then drag it and it will move while newly added faces connect it to its original location. The effect is like forcing Play-Doh through a hole.

  • Inseting: Select a face and hit the I key. Move the mouse and you will see a smaller face, the same proportion as the original, is created inside the original face and four more faces connect it to the original edges.

Exercise

For the second-half of the session, we took a cylinder shape and started to sculpt it into a candlestick shape. A few lessons from that were:

  1. We started with the simple cylinder and added loads of loop-cuts to allow us to shape the candlestick shape.
  2. We saw how proportional editing can be switched on to allow vertices connected to those we’re directing editing to be moved as well.
  3. We saw how the bottom and top of the cylinder are N-gons and look strangely domed when smooth shading is on. We resolved that by insetting the face to minimise the N-gon’s size and extruding it out of the way a bit.
  4. We saw how adding loop-cuts near an existing edge can restore a sharp edge to our model when smooth shading makes it seem too soft and round.
  5. We saw how the “Metallic” and “Smoothness” sliders can be used on a material to make it look like shiny metal.

Screenshot 2019-09-28 at 13.45.03.png

Next Week

Next week is intended as a free-form session, bring your best ideas for simple projects and we’ll try to help you achieve them. See you then!

Modellers – Week 1

blender-socket

Hi folks and welcome to our new group, Modellers. This year we’re going to be mainly looking at the 3d modelling package Blender Version 2.80.

Blender can be installed from: www.blender.org. Please note that it requires OpenGL Version 3.3 or higher and as a result may not work on some older machines

 

This week we learned:

  1. The 3D viewport and moving around in it:
    1. Middle mouse button: Orbit
    2. Shift + Middle Mouse Button: Pan
    3. Scroll Wheel: Zoom
  2. Selecting objects with the left mouse button
  3. The toolbar tools for moving, rotating and scaling objects
  4. Deleting objects with ‘x’
  5. Adding new mesh objects from the “Objects” menu
  6. Adding a new material slot and a new material and assigning a colour to it
  7. Putting the 3D Viewport into “Look Dev” mode so that material colours can be seen

We also gave out copies of a very convenient Blender Infographic which can be found here.

Screenshot 2019-09-25 at 23.43.52.png

Explorers Week 01 – Getting to know Scratch

Hello everyone

Welcome to Coderdojo Athenry and the Explorers group! It was great to see so many new faces on Saturday and of course I’m always delighted to see those you are back for another year!

We just spent a short time familarising our self with Scratch and where we can find the code and some small examples od how we can use them. We will start a new game this coming week and will jump straight in using variables, loops and decision statements.

Here are the notes from last week. CDA-S8 Week_02-YourNameinLights.pdf

Martha

&

Julie, Iseult, Cara, Ruaidhrí and Eoin

Creators – Random Dungeon

This week we took a look at a technique for generating random dungeons. Although never mentioned on the day, this technique is often called “marching squares”. It looks at the four corners of a space at a time, some of which are open and some of which are closed, and picks a shape that blocks off the closed corners.

There are sixteen possible combinations of corners on and off. All of these can be covered with these five shapes (or a rotation of them) to represent the closed off areas:

marchs

Generating the Dungeon

We generated a 2D array (a list of lists) to store our dungeon layout. At each point we used a 2D Perlin noise value (using the noise() function) to calculate a value. The point was deemed to be either open or closed based on whether this value was higher or lower than a threshold value we specified. Varying this threshold value can make the dungeon more open, or more closed in.

Drawing the Dungeon

To draw these shapes we first defined each of them as a list of x, y points defining the shape.

We then used beginShape()vertex(), and endShape() functions to draw them at the correct size, location and orientation by scale(), transform() and rotate().

Once we were able to draw the shapes, we just needed to loop over our grid, inspecting each set of four adjacent corners in turn and drawing the appropriate shape.

Here’s a screenshot of one random dungeon. Dots (green for open, red for closed) are drawn to show the grid and the lines between the individual shapes are also shown for clarity:

d2

and here is is without these overlays:

d1

Download

The files for this week can be found on our GitHub repository.

Creators – Quiz and Hacking

Screenshot 2019-05-02 at 00.23.50.png

This week we had a quiz. There were three rounds on Technology, Creators 2019 and Pop Culture. There was a very high proportion of correct answers on all questions. The quizes can be found here, for anyone that wants them:

Creators 2019

Pop Culture

Technology

 

After that we set everyone a programming challenge: make an animated scene. People got busy and there was some good progress. We will continue with that next week. Mark and I (Kieran) got in on the action figuring out how to draw clouds. My attempt is shown in the image at the top of this post. The code can be found, as always, on the CoderDojo Athenry Creators 2018 GitHub.