Lab 02: Robot Brain

My partner and I wanted to take inspiration from nocturnal animals, playing with the sensitivity to light and sound. We originally decided that the robot should react accordingly to a sudden increase in light or noise. 

Our Sketch:

The plan was to have the robot start off moving in random directions, but stop in the presence of bright light. In response to loud noises, we wanted it to display a certain pattern of lights, and shake. If an object comes too close to the robot, it will increase the distance between the object and itself, through the use of the proximity sensor. 

Because we did not have the proximity sensor or a buzzer (for the shaking effect), we wanted to represent the behavior using lights. We utilized the built in photocell in the microbit to measure the light level.

Our Code:

let light = 0

basic.showNumber(input.lightLevel())

light = input.lightLevel()

if (light < 20) {

   basic.showIcon(IconNames.Heart)

}

if (light > 20) {

   basic.showNumber(IconNames.Sad)

}

The microbit displayed a heart icon during low light conditions, and a sad face during increased light conditions. However, there were some issues with the photocell detecting light levels, so in the code below, we edited the sad face function to display the number for the light intensity. 

Our Edited Code: 

basic.showNumber(input.lightLevel())

let light = input.lightLevel()

if (light < 20) {

   basic.showIcon(IconNames.Heart)

}

if (light > 20) {

   basic.showNumber(input.lightLevel())

}

Reflection #5: Biomimetics – Nature Based Innovation

Summary:

This chapter explore various examples of biomimetics and bio-inspired inventions. According to the the author on page 2:

“Nature is effectively a great laboratory where trial and error experiments are made..”

Definitions:

  • Biomimetics: Seeks to understand and use nature as a model for copying, adapting and inspiring concepts and designs
  • Natural forms – they occur naturally in ambient conditions
  • Imitations: Made made components usually created under heat and pressure
  • Robot – a biomimetic machine with humanlike features running via electromechanical mechanism with the ability to sense its environment with some degree of intelligence.

Examples:

  • Camouflage- military uniforms mimic animals to blend in
  • Beaver’s Dam – man made dames to serve similar purpose
  • Honeycomb – structure used for sound proofing (an adaptation is using egg crates)
  • Plant water system – can be studied for improved irrigation?

Questions:

With the table example, furniture is said to mimic animals which stand on four legs. Considering that the four legs widen the base thous lowering the centre of gravity this can be the reason for the structure. However was this information common knowledge when the first piece of furniture was invented?

Is it better to understand and imitate the benefits of nature (eg camouflage) or to imitate nature itself (eg robots)?

I don’t really understand the inchworm example and would need further clarification on it.

What’t the relationship between biomimetic inventions and physics. Which is dependent on the other?

If nature’s evolution has allowed for biomimetics to even be possible due to its trial and error style, wouldn’t it be counterproductive to the evolutionary process?

What is the difference between operations, such as operations in water, and bio-inspired invention. 

Reflection:

This article was very insightful in showing how much nature as influences humanity for centuries. By preserving and better nourishing our environment, we can truly learn a great deal from it and for it. 

Lab report 2 (Molly)

  1. Testing the light sensor

I discovered that the light sensor is at the front of the micro:bot, while other sensors such as the accelerometer and one more (perhaps the magnetic sensor) are at the back.

I opened the flashlight when filming. Therefore, when the camera gets closer to the micro:bot, the light level is higher and the smile shows up. 

2. Wireless communication

When the A button is pressed on the first board, the second board would show the number 0. The communication system is easy to establish, conveying numbers, strings, tuples, etc.

3. Animal behavior system

It imitates the natural behavior of the turtle’s retracting its head when facing danger. The program is simple, and the “turtle” is abstract as well. 

Reflection:
Given little time, we had to come up with these very basic ideas. Next time, I shall read and think about the lab template carefully before the class comes, so that deliberateness could be involved in the learning process.

Lab 2: Robot Brain, Anand Tyagi

First Thoughts and Limitations of the Micro:bit:

Our first interaction with the hardware involved taking the voltage of the micro:bit at different points of the board. We noticed that from 0 to Ground, 1 to Ground, and 2 to Ground, the voltage was 1.675 V. However, at the 3V section, the voltage was 3.187 V. This is probably a reflection of the fact at the general metal can carry 1.675 Volts and that the actual 3V section can take up to 3.187 Volts from what we found. So, I reason the metal must be slightly different at that point which is causing that voltage difference.

 

After playing around with the already installed code (and playing some Snake) we moved onto playing with some of the code. We started with displaying some text. From this we noticed that some of the limitations of the board include the inability to make clearly round images and not being able to display a lot of information on the board. The mere 25 LEDs made for a poor resolution, thus preventing us from making anything near a circle. Along with that, because there were so few LEDs, we had to often scroll any information we wanted to see across the whole board. Naturally, this would also pose a problem when playing games on this device as well, or displaying a lot of text.

Experimentation and Tinkering:

Eventually, we moved onto more sophisticated projects, such as trying to connect two micro:bits together by radio. However, we later moved onto trying to make a simple space-invaders like game.

From connecting the micro:bits through radio, it is possible to relate the connection between the two to our own communications as humans. In order to get any large tasks done, we must communicate in some manner. In fact, at some point, and even now, we relied heavily on radio communications to talk to each other over long distances. So, this is one way in which we can mimic the life-like behavior of communication.

After playing around with the radio connection features of the micro:bit, we decided to start the programming of a space-invaders type game. While it may not seem to represent any type of animalistic behavior at first, one feature of animals that comes to mind is the nature of competing species. When more than one species inhabits an area, they must learn to coexist. But many times, there turns out to be one dominant species within a particular region. This is represented in the game as the player represents one species and the aliens represent an invading species. Thus, it logically follows that the two species would proceed to attack each other, as they do in the game.

This piece of code is the start of a space-invaders type game. For the time we had, we were able to create a player and control its movement using the A and B buttons. One of the problems we ran into was figuring out how to get the player to only move one space at a time. Initially, we used the function is.pressed() in order to register when to move the player. But we realized that this was causing the player to move the entire duration of the press, which typically lasted for more than a few seconds. Eventually, we were able to figure out that the function we really needed to utilize was the was.pressed() function, which would only move the player after the button was pressed and then released. Besides that, we were able to successfully create a player that could move around the “screen”.

The full code can be viewed at https://gist.github.com/ananddtyagi/d327b23d1b76948e44b90cb4371a7920

Here is a video of what were able to code:

Animal Behavior Diagram:

This diagram represents the animal behavior of competition between species that inhabit the same area.

Reflection:

Using the micro:bit was a useful tool to start learning how to make systems or programs that reflect the world around us. The use of sensors and motors help us copy many of the functions that we posses as humans. Besides that, we can also simulate animalistic behaviors on the software end of things, as our main project focused on, which can help us to understand or predict situations that occur naturally. Overall, I enjoyed using the micro:bit and look forward to playing around with it more.