• Blogs
• Unit 1 - Introduction to Robotics - Exercises & Activities

## Unit 1 - Introduction to Robotics - Exercises & Activities

• Public
By Darren Hurren June 25, 2019 - 12:40pm

Exercises from Instructors Weblog (a.k.a. Instructors notebook):

-tackle the circuits and programs in the order they are presented (in the SIK guide v3.3), starting with Circuit #2 and continuing through Circuit #7. (NOTE: Since I received the SIK Guide v4.0a I will be using this to expirement with coding and electronics instead of the SIK guide version 3.3).

I dove right into the SIK guide v4.0a that came with the SIK v4.0 without realizing that I was supposed to be using the older version of the guide (v3.3). I'll try to make some comparison's between the two as I go. I also didn't realize pictures and videos were needed so i unfortunately don't have anything like this until the later projects / circuits. Here are the circuits I completed from the SIK v4.0a guide:

Circuit 1A: Blinking an LED (Same as Circuit 1 in 3.3 guide):

This circuit was as easy as it gets. I expirimenteded with changing the delay, reducing this made the LED blink faster and increasing the delay made it flash on and off for a longer duration. I think I reduced the delay to around 30 or 40 ms on & off before it became unnoticeable that the LED was actually flashing (it looked like it was on solid).

Circuit 1B: Potentiometer (Same as circuit 2 in v3.3 guide):

This circuit uses the analogRead(); function to read the input voltage through the potentiometer (which is acting as a resistor divider) and changes the rate at which the LED flashes based on that reading. This was the first circuit that used the Serial monitor on the Arduino IDE software. I guessed at adding a "*2" operator to the analogRead(); function to double the input range from 0 to 2046.

Circuit 1C: Photoresistor (Same as circuit 6 in v3.3 guide):

This circuit uses a photoresitor in a voltage divider circuit to change the analog read input that controls when the LED turns on or off. When the photoresistor senses light it has lower resistance and when it it dark there is higher resistance. I had to adjust the threshold integer variable's value since it was darker in my room. I also added the resistor into the voltage divider and could see the LED birghtness change based on the amount of light then photoresistor was receiving.

Circuit 1D: RGB night light (This circuit was similar to: Circuit 3: RGB LED & Circuit 6: Photoresistor & Circuit 2: Potentiometer in 3.3 Guide):

This circuit was really cool! Change the pot value and the RGB LED color will change when the photoresistor varaible's value is lower then the threshold. I made this circuit again so I could capture a video of it and remembered that there was a small mistake in the example code. I had to change the operator value to "potentiometer >= 0" or else when the potentiometer was set to 0 (analogRead value), the RGB LED would not light up at all when the threshold value was reduced to a value below 700. Note: In the room I am in, the photoresistor value when it was light was ~900 and when dark (covered with finger) was ~630. Another thing I noticed was the yellow color looked more green then it did yellow. I couldn't get the LED to look more "yellow" then this though since if I bumped up the red value it looked more orange-y. Maybe this RGB LED is not able to make this color or my eyesight isn't the greatest...

Circuit 2A: Buzzer (similar to Circuit #11 in the SIK guide 3.3):

This circuit changes the volume of the buzzer by adjusting the voltage going through the buzzer using the potentiometer. I had to make sure the potentiometer was at it's lowest resistance setting in order for the buzzer to have the maximum amount of voltage flowing through it, otherwise it was very hard to hear. My potentiomer doesn't seem like it has a very linear resistance value when resistance value is changed... Pretty cool how all the notes were preset as functions which would make creating your own songs very easy. I want to spend time making it play some familiar songs.

Circuit 2B: Digital Trumpet

This circuit changed the tone output through the buzzer depending on which button ws pressed. I had a hard time getting more then three notes to play with different combinations of pushbuttons being pressed. I realized that I had to make the first IF statement have the most push buttons pressed in or else it would only play the tone as if one pushbutton was pressed. I guess it's a hierarchical order of operations if that makes any sense (I really new to coding so this is probably so obvious to most people). Anyways I started the If statement with the 3 pushbuttons all at once, then combinations of two pushbuttons, then the individual ones. It worked great after. I still had to make sure the volume was cranked to it's highest in order to hear it.

Circuit 2C: "Simon Says" Game (similar to Circuit#16 in v3.3 guide)

This circuit was by far the coolest (until I got into the motor control circuits). I had a bunch of people try this out as well after I built the circuit and modified the code to make it a bit easier. Changing the sound effects and difficulty was easy. I couldn't figure out how to make it a two player game but I didn't send too much time messing around with that. Maybe I will try searching through the blogs to see if someone else has already explained this in detail. I took a video of this circuit. I like how it showed how to set this circuit up in the v4.0a Guide as opposed to the v3.3 guide since the buttons and LED's are all side-by-side, which madde it a bit easier to play.

The temperature sensor circuit was circuit #7 in the SIK v3.3 guide. I will explore this when I get to Circuit 4B: Temperature Sensor in the 4.0a guide since it also uses an LCD display (it looks funner and I'm still learning the concepts of how the temperature sensor works)

-Activities using the text Companion Workbook: Read through the text companion workbook section titled Robotic Components. Answer the questions posed in this section of the workbook in your own weblog.

Exercise 1: Sensors and Sensor space

1. List each of the Create's sensors. Refer to the iRobot Create's owners manual for help as some sensors may not be obvious.

I'll start with the three obvious ones first: Ultrasonic Distance Sensor, Temperature Sensor and a Photoresistor.

I think the 4 pushbuttons, switch and potentiometer can also technically be sensors if they were positioned in a certain way or had extra parts attached (like whiskers for example).

There was one more possibility that I was considering but after looking this up on an Arduino forum it turns out not to be true. I was thinking that the Peizo buzzer could be used to detect sound and convert that to a voltage. According to this post on the Arduino discussion board (https://forum.arduino.cc/index.php?topic=394083.0, only a transducer or speaker can do this. I think that buzzers and speakers are actually transducers by definition. I know a bit about how speakers work; an electromagnetic force is created by putting a voltage through a coil, which pushes a diaphragm (convertign an electrical signal into a mechanical vibration). I thought all peizo devices could either generate a vibration if a voltage was applied to a crystal, or create a voltage if a mechanical force is applied to the crystal, but I guess that's only one type of device.

2. Define the Create's sensor space. For each of the sensors, identify what it perceives and the range of possible sensor readings.

The SIK External State Space = (Push buttons x4)+(potentiometer)+(Switch)+(Ultrasonic Distance Sensor)+(Temperature Sensor)+(Photoresistor)

Pushbuttons each have two states (ON or OFF), this means 2^4 possible combinations (16 total)

Potentiometer has a set resistance (I don't know how much, 0 Ohms to ____ Ohms). Converted to analog read on the Arduino this value can range from 0 to 1023, so 1024 combinations total.

Switch only has ON or OFF

Ultrasonic distance sensor sense sound waves of a certain frequency (40kHz) has a max range of 4m and a min range of 2 cm. Even though it has these values, there is potentially infinite values in between those ranges.

Temperature sensor senses temperature by detecting the voltage across the base and emitter of a diode. It has potentially infinite values and can operate in the range of temperatures from: -40°C to 150°C

The photo resistor senses light and changes resistance based on the amount of light (dark means more resistance, and light means less resistance)

Exercise 2: Effectors and Actuators

1. Describe the difference between effectors and actuators.

Actuators are the devices that control Effectors. They provide the power to do the work that the effector will carry out on it's environment (i.e. DC motors, servo motors, relays). Effectors are the physical mecanisms that all have an "effect". Examples of these are wheels, grabbers, tracks etc.

2. List each of the Create's actuators and effectors.

The SIK has 2 types of effectors: 2x wheels and some plastic parts to install on the servo motor

It has 2 types of actuators as well: 2 x gear motors and 1 x servo motor

3. List the degrees of freedom for the Create.

The SIK has only 2 Degrees of Freedom (DOF). If using both wheels it can ddrive forward and reverse (one DOF; Y-axis) and it can turn (one DOF; Yaw). I'm wondering though if the SIK robot was to drop, does that mean that it has another potential DOF? I think not since that would only allow it to move in one direction.