The Occupy Mars Learning Adventure

Training Jr. Astronauts, Scientists & Engineers


Leave a comment

Morse Code Tiger Team Project One

Arduino Morse Code

by in arduino

featuredIntroduction: Arduino Morse Code
Arduino Morse Code

When I was younger I started practicing for my Ham Radio license but did not stick with this long enough to master the morse code. With this project you can convert any text to morse code. This project will show you how to create a basic circuit which converts the text to morse code and blinks LED lights while playing audio of the translated dots and dashes.

This is my first Instructables project so I hope you like it! In this project I will assume you have some very basic knowledge of electronics and uploading code to the Arduino. Check out many other great Instructables for help on this if necessary. This is a really easy project so I’m sure you will not have any issues.

Step 1: Gather the Parts

Gather the Parts

For this project use an Arduino Uno micro controller connected to a solderless breadboard.

  • 1 – Andruino
  • 1 – Solderless Breadboard
  • 3 – Resistors (220 Ohm)
  • 1 – 8-ohm Mini Speaker
  • 2 – 5mm LED Lights
  • 3 – Short Jumper Wires (1 cm)
  • 4 – Longer Jumper Wires (6 – 10 cm)
  • 1 – USB Cable

Step 2: Setup the Circuit Board

Setup the Circuit Board
IMG_8478.JPG
IMG_8481.JPG

First setup the breadboard to connect the two LEDs and one speaker as seen in the wiring diagram. Connect the small jumper from the ground to one row. On a second row connect a longer jumper cable and a resistor. The LED light or speaker will bridge these two rows. When connecting the LEDs, the positive leg (longer of the two wires coming out of the LED) should be connected to the line with the resistor and the negative leg will be on the grounded row.

Step 3: Connecting the Arduino

Connecting the Arduino

Now that you have the breadboard wired you will connect this to the Arduino. In the code we will be using output pins six and twelve for the LED lights and pin eight for the audio. Connect the two longer jumper wires with the LEDs inline to pin six and twelve on the Arduino. Connect the longer jumber wire with the speaker to pin eight. Finally, connect the GND pin to the ground bus at the top of the breadboard.

Step 4: Uploading the Code

Next connect your computer to the Arduino via the USB cable. Using the Arduino compiler upload the following code. To modify the morse code string just change the ‘stringToMorseCode’. The code will read this string and convert the string to morse code, both visual and audio.

The code reads the string to an array and then using the GetChar function this converts each character into dots and dashes. Currently this is just converting alphabetic characters but you can easily add additional characters (numbers, punctuation) in this select statement switch at the bottom of the code.

/*
Morse Code Project This code will loop through a string of characters and convert these to morse code. It will blink two LED lights and play audio on a speaker. */ //**************************************************// // Type the String to Convert to Morse Code Here // //**************************************************// char stringToMorseCode[] = “Arduino Morse Code Project”;

// Create variable to define the output pins int led12 = 12; // blink an led on output 12 int led6 = 6; // blink an led on output 6 int audio8 = 8; // output audio on pin 8 int note = 1200; // music note/pitch

/* Set the speed of your morse code Adjust the ‘dotlen’ length to speed up or slow down your morse code (all of the other lengths are based on the dotlen)

Here are the ratios code elements: Dash length = Dot length x 3 Pause between elements = Dot length (pause between dots and dashes within the character) Pause between characters = Dot length x 3 Pause between words = Dot length x 7 http://www.nu-ware.com/NuCode%20Help/index.html?m… */ int dotLen = 100; // length of the morse code ‘dot’ int dashLen = dotLen * 3; // length of the morse code ‘dash’ int elemPause = dotLen; // length of the pause between elements of a character int Spaces = dotLen * 3; // length of the spaces between characters int wordPause = dotLen * 7; // length of the pause between words

// the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output for LED lights. pinMode(led12, OUTPUT); pinMode(led6, OUTPUT); }

// Create a loop of the letters/words you want to output in morse code (defined in string at top of code) void loop() { // Loop through the string and get each character one at a time until the end is reached for (int i = 0; i < sizeof(stringToMorseCode) – 1; i++) { // Get the character in the current position char tmpChar = stringToMorseCode[i]; // Set the case to lower case tmpChar = toLowerCase(tmpChar); // Call the subroutine to get the morse code equivalent for this character GetChar(tmpChar); } // At the end of the string long pause before looping and starting again LightsOff(8000); }

// DOT void MorseDot() { digitalWrite(led12, HIGH); // turn the LED on digitalWrite(led6, HIGH); tone(audio8, note, dotLen); // start playing a tone delay(dotLen); // hold in this position }

// DASH void MorseDash() { digitalWrite(led12, HIGH); // turn the LED on digitalWrite(led6, HIGH); tone(audio8, note, dashLen); // start playing a tone delay(dashLen); // hold in this position }

// Turn Off void LightsOff(int delayTime) { digitalWrite(led12, LOW); // turn the LED off digitalWrite(led6, LOW); noTone(audio8); // stop playing a tone delay(delayTime); // hold in this position }

// *** Characters to Morse Code Conversion *** // void GetChar(char tmpChar) { // Take the passed character and use a switch case to find the morse code for that character switch (tmpChar) { case ‘a’: MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘b’: MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘c’: MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘d’: MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘e’: MorseDot(); LightsOff(elemPause); break; case ‘f’: MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘g’: MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘h’: MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘i’: MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘j’: MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘k’: MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘l’: MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘m’: MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘n’: MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘o’: MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘p’: MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘q’: MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘r’: MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘s’: MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; case ‘t’: MorseDash(); LightsOff(elemPause); break; case ‘u’: MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘v’: MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘w’: MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘x’: MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘y’: MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); break; case ‘z’: MorseDash(); LightsOff(elemPause); MorseDash(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); MorseDot(); LightsOff(elemPause); break; default: // If a matching character was not found it will default to a blank space LightsOff(Spaces); } }

/* Unlicensed Software: This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to */

Step 5: Testing the Project

Testing the Project

Now the fun part, test it out! The code will play through the morse code string and then pause for several seconds before looping again. Play around with code and circuit layout. Try adding a few extra lights in parallel with each other. Also play around with the code by changing the “dotLen” variable to adjust the length of the dots and dashes (speeds up/slows down the morse code). Change the “note” variable to adjust the audio pitch.

Let me know how this works for you and if you have any improvements!

Chris Weatherford

Morse Code Player Code (Revised By Curt Rowlett)

/*
  Morse Code Project
  This code will loop through a string of characters and convert these to morse code.
  It will blink two LED lights and play audio on a speaker.
 */
//**************************************************//
//   Type your message to convert to Morse code below  //
//**************************************************//
char stringToMorseCode[] = “INSERT YOUR MORSE CODE TEXT HERE”;
// Create variable to define the output pins
int led12 = 12;      // blink an led on output 12
int led6 = 6;        // blink an led on output 6
int audio8 = 8;      // output audio on pin 8
int note = 1200;      // music note/pitch
/*
  Set the speed of your morse code
  Adjust the ‘dotlen’ length to speed up or slow down your morse code
    (all of the other lengths are based on the dotlen)
  Here are the ratios code elements:
    Dash length = Dot length x 3
    Pause between elements = Dot length
      (pause between dots and dashes within the character)
    Pause between characters = Dot length x 3
    Pause between words = Dot length x 7
*/
int dotLen = 100;     // length of the morse code ‘dot’
int dashLen = dotLen * 3;    // length of the morse code ‘dash’
int elemPause = dotLen;  // length of the pause between elements of a character
int Spaces = dotLen * 3;     // length of the spaces between characters
int wordPause = dotLen * 7;  // length of the pause between words
// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output for LED lights.
  pinMode(led12, OUTPUT);
  pinMode(led6, OUTPUT);
}
// Create a loop of the letters/words you want to output in morse code (defined in string at top of code)
void loop()
{
  // Loop through the string and get each character one at a time until the end is reached
  for (int i = 0; i < sizeof(stringToMorseCode) – 1; i++)
  {
    // Get the character in the current position
  char tmpChar = stringToMorseCode[i];
  // Set the case to lower case
  tmpChar = toLowerCase(tmpChar);
  // Call the subroutine to get the morse code equivalent for this character
  GetChar(tmpChar);
  }
  // At the end of the string long pause before looping and starting again
  LightsOff(8000);
}
// DOT
void MorseDot()
{
  digitalWrite(led12, HIGH);    // turn the LED on
  digitalWrite(led6, HIGH);
  tone(audio8, note, dotLen); // start playing a tone
  delay(dotLen);              // hold in this position
}
// DASH
void MorseDash()
{
  digitalWrite(led12, HIGH);    // turn the LED on
  digitalWrite(led6, HIGH);
  tone(audio8, note, dashLen);  // start playing a tone
  delay(dashLen);               // hold in this position
}
// Turn Off
void LightsOff(int delayTime)
{
  digitalWrite(led12, LOW);     // turn the LED off
  digitalWrite(led6, LOW);
  noTone(audio8);             // stop playing a tone
  delay(delayTime);             // hold in this position
}
// *** Characters to Morse Code Conversion *** //
void GetChar(char tmpChar)
{
  // Take the passed character and use a switch case to find the morse code for that character
  switch (tmpChar) {
    case ‘a’:
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘b’:
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘c’:
      MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘d’:
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘e’:
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘f’:
      MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘g’:
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘h’:
      MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘i’:
      MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘j’:
      MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
      case ‘k’:
      MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘l’:
      MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
      case ‘m’:
      MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘n’:
      MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘o’:
      MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘p’:
      MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘q’:
      MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘r’:
      MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘s’:
      MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘t’:
      MorseDash();
    LightsOff(elemPause);
    break;
    case ‘u’:
      MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘v’:
      MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘w’:
      MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘x’:
      MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘y’:
      MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘z’:
      MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘0’:
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘1’:
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘2’:
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘3’:
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘4’:
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    break;
    case ‘5’:
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘6’:
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘7’:
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘8’:
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    case ‘9’:
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDash();
    LightsOff(elemPause);
    MorseDot();
    LightsOff(elemPause);
    break;
    default:
    // If a matching character was not found it will default to a blank space
    LightsOff(Spaces);
  }
}

 

Advertisements


Leave a comment

Where are the talented science students?

Regeneron Science Talent Search 2018

Regeneron STS logo
The Regeneron Science Talent Search (Regeneron STS), a program of Society for Science & the Public (Society) is the nation’s most prestigious science research competition for high school seniors.  Since 1942, first in partnership with Westinghouse, then with Intel 1998-2016, and now with Regeneron, the Society has provided a national stage for the country’s best and brightest young scientists to present original research to nationally recognized professional scientists.
The application for the Regeneron Science Talent Search 2018 will open August 1, 2017. To learn more about the Regeneron Science Talent Search, visit

Please complete this form if you would like to be notified about Regeneron Science Talent Search program updates, including the release of the official rules, the launch of the 2018 application, and more.


Leave a comment

Radar Project 6 for the USA Occupy Mars Tiger Teams

Students on the USA Tiger Teams are working on special projects that will help occupy Mars.   We are building our collection of solutions and will present that at the Mars Society Convention in Irvine, California in September, 2017.

Arduino Radar

by J.B. Wylzan

Project 25:  Radar Scanner Display
This project shows how objects are detected and displayed on your computer screen imitating a radar monitor. A separate software called Processing 3.0a10 was used to interact with the Arduino R3 IDE.

Hardware:
Microservo SG90
Ultrasonic Sensor
connecting wires
breadboard
Arduino R3 UNO board

Code # 25:

/*
iHacklab Radar Monitor Display
This project, inspired by Dejan Nedelkovski,
was modified to fit the display into a standard computer monitor
reprogrammed by JBWylzan

Using Graphics Interface provided by Processsing 3.0
The example code is public domain */

import processing.serial.*;
import java.awt.event.KeyEvent;
import java.io.IOException;

Serial myPort;
String angle=””;
String distance=””;
String data=””;
String noObject;
float pixsDistance;
int iAngle, iDistance;
int index1=0;
int index2=0;

void setup() {
size (1000, 500);
smooth();
myPort = new Serial(this,”COM4″, 9600);
myPort.bufferUntil(‘.’);
}

void draw() {
fill(98,245,31);
noStroke();
fill(0,4);
rect(0, 0, width, 1010);
fill(98,245,31); // green
drawRadar();
drawLine();
drawObject();
drawText();
}

void serialEvent (Serial myPort) {
data = myPort.readStringUntil(‘.’);
data = data.substring(0,data.length()-1);
index1 = data.indexOf(“,”);
angle= data.substring(0, index1);
distance= data.substring(index1+1, data.length());
iAngle = int(angle);
iDistance = int(distance);
}

void drawRadar() {
pushMatrix();
translate(500,480);
noFill();
strokeWeight(2);
stroke(98,245,31);
arc(0,0,1000,1000,PI,TWO_PI);
arc(0,0,800,800,PI,TWO_PI);
arc(0,0,600,600,PI,TWO_PI);
arc(0,0,400,400,PI,TWO_PI);
arc(0,0,200,200,PI,TWO_PI);
line(-500,0,500,0);
line(0,0,-500*cos(radians(30)),-500*sin(radians(30)));
line(0,0,-500*cos(radians(60)),-500*sin(radians(60)));
line(0,0,-500*cos(radians(90)),-500*sin(radians(90)));
line(0,0,-500*cos(radians(120)),-500*sin(radians(120)));
line(0,0,-500*cos(radians(150)),-500*sin(radians(150)));
line(-500*cos(radians(30)),0,500,0);
popMatrix();
}

void drawObject() {
pushMatrix();
translate(500,480);
strokeWeight(9);
stroke(255,10,10); // red
pixsDistance = iDistance*22.5;
if(iDistance<30){
line(pixsDistance*cos(radians(iAngle)),-pixsDistance*sin(radians(iAngle)),500*cos(radians(iAngle)),-500*sin(radians(iAngle)));
}
popMatrix();
}

void drawLine() {
pushMatrix();
strokeWeight(9);
stroke(30,250,60);
translate(500,480);
line(0,0,500*cos(radians(iAngle)),-500*sin(radians(iAngle)));
popMatrix();
}

void drawText() {
pushMatrix();
textSize(14);
fill(98,245,60);
translate(500,490);
text(“90°”,0,5);
text(“www.iHackLab.blogspot.com        0°”,250,5);
text(“180°”,-500,5);
popMatrix();
}

Challenge:
Use the sketch above and your previous projects on Servo and Ultrasonic to detect objects and monitor them on a radar-like screen display.

Actual Layout:



Procedure:
1. Build the prototype as shown above
2. Run the Processing Interface
3. Select File > New
4. Copy Code #25 above
5. Paste Code #25
6. Click File > Save
7. Click Run
8. Wait for the Screen to display
9. Open previous projects on ultrasonic or servo
10. Upload sketch and run your hands on the ultrasonic


Leave a comment

Morse Code Project 6 for Occupy Mars Learning Adventures

Barboza Space Center USA Tiger teams are working on several emergency communication systems for the planet Mars.  This is one of six systems that our students are working on.  www.BarbozaSpaceCenter.com

Morse Code

by J.B. Wylzan

Project 13:  Morse Code 
This project  shows how to control an RGB Led colors using **modular programming.

Hardware:
RGB led
3 resistors
connecting wires
breadboard
Arduino R3 UNO board

Block Diagram:

Code # 13:

/*
iHackLab Morse Code
powered by Arduino
sketched by J.B. Wylzan
modified by Lawsinium

The RGB LED will display the morse code for I LOVE YOU.
This example code is public domain.
*/

int redPin = 8;
int greenPin = 7;
int bluePin = 6;

void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
//pinMode(bluePin, OUTPUT);
}

// .. / .-.. — …- . / -.– — ..-   <<< I LOVE YOU

void loop()
{

dit(); dit();
pause();
dit(); dat(); dit(); dit();
dat(); dat(); dat();
dit(); dit(); dit(); dat();
dit();
pause();
dat(); dit(); dat(); dat();
dat(); dat(); dat();
dit(); dit(); dat();
delay(1000);
}
// …………………………………………………………………………………………………….

( Only for Reference; don’t add the pic on your sketch )

// …………………………………………………………………………………………………….
void dit()
{
digitalWrite(redPin , HIGH);
delay(250);
digitalWrite(redPin , LOW);
delay(250);
}

void dat()
{
digitalWrite(greenPin , HIGH);
delay(1000);
digitalWrite(greenPin , LOW);
delay(250);
}

void pause()
{
digitalWrite(bluePin, HIGH);
delay(1000);
digitalWrite(bluePin, LOW);
delay(1000);
}

**Programmers Technique**

Modular Programming is one of the techniques programmers use to shorten their programs. Instead of writing very long algorithm, programs are contain into a chunk, a modular procedure. The functions dit(), dat(), and pause() are all procedures put into functional modules. This means that instead of writing all the sketch in every module inside the void loop() section, we simply use the shortcuts: dit(), dat(), and pause().

Challenge:
1. Sketch a program using a speaker that will produce the morse code sound for I LOVE YOU.
2. Sketch a program with a push button that will mimic the morse code for I LOVE YOU.

Actual Layout:



Procedure:
1. Build the prototype as shown above
2. Run the Arduino Interface
3. Select File > New
4. Copy Code # 13 above
5. Paste Code #13
6. Click File > Save
7. Click Verify
8. Click Upload
9. The RGB led will blink on and off like a morse code.


Leave a comment

Can lightning storms be found on Mars

How Sandstorms Generate Spectacular Lightning Displays

How can nonconducting sand particles transfer the huge amounts of charge needed to generate spectacular lightning displays? A new model finally explains this phenomenon.

Comments:  Our students have been asking if there are lightning storms on Mars?   

We wanted to share this article that came from MIT.

One of the fascinating features of volcanic cloud plumes is the extraordinary displays of lightning they generate. Similar discharges occur in sandstorms and in the dust blown up by helicopters flying over deserts causing dangerous arcing. These lightning storms are as puzzling as they are spectacular.

There are two parts to the problem. First, particles of sand are more or less identical, in size shape and chemistry. How then do they transfer charge between them? Second, sand particles are insulators, not conductors, which makes it doubly strange that they can be involved in the transfer of such massive amounts of charge. What on Earth is going on?

Today, Thomas Pähtz at the Swiss Federal Institute of Technology in Zurich and a couple of buddies say they can explain the whole thing with a deceptively simple new model. What’s more, their model makes some straightforward predictions about the way sand particles transfer charge.

Here’s their idea. They begin by thinking of sand particles as identical dielectric spheres. In an electric field, dielectric particles become polarised, causing charge to gather on each side of the sand spheres. When two spheres touch, the charge redistributes across the boundary between them, creating a larger, doubly polarised particle. The key idea is what happens when this breaks into two again: each particle ends up with a net charge (see picture above). The process of polarisation then begins again allowing the particles to increase their charge even further with each collision. It’s not hard to see how a relatively small number of collisions could end up transferring huge amounts of charge in this way despite the absence of any kind of conducting medium.

This model makes some interesting predictions about the rate at which a cloud of sand should pump charge. For example, it predicts that shallow clouds of dust would end up being charged only weakly. This is what you might expect from weak winds or heavy grains. Similarly, very thick clouds should result only in weak charging. However, Pahtz and co says that in intermediate clouds, there should be dramatic charging. And sure enough, that’s exactly what they find, both in numerical simulations of dust clouds and in actual experiments they’ve performed with real sand.

“We find as predicted that shallow agitated beds – as could be expected in weak winds or for heavy grains – charge weakly, as do very deep agitated beds – as would be expected for highly dissipative materials. Under intermediate conditions, however, we observe dramatic charging, with the most highly charged particles found preferentially near the top of the agitated bed,” they say.

That’s an elegant idea that produces some fascinating results. But it leaves open one very important question. In real storms, what generates the electric field that polarises the sand particles in the first place? It looks like Pahtz and co will have interesting time ahead getting to the bottom of that one.

Ref: http://arxiv.org/abs/1003.5188 Why do Particle Clouds Generate Electric Charges?

Tech Obsessive?
Become an Insider to get the story behind the story — and before anyone else.


Leave a comment

Space Geology: Moki and Moqui Marbles Found on Our Summer Field Trip Studying About Mars

Mars on Earth: How Utah’s Fantastical Moqui Marbles Formed

On our most recent geology field trip in 2017.  The Occupy Mars Learning Adventures team came upon two new discoveries.  Moki and Moqui Marbles.  Which is correct????

Here is what the California team discovered.

Moki marbles_1633.JPGIMG_1631.JPGIMG_1632.JPG

 

Mars on Earth: How Utah's Fantastical Moqui Marbles Formed
Moqui marbles on a sandstone slope.

Credit: Marjorie Chan, University of Utah

Hikers rambling through Utah’s candy-striped canyons sometimes come across a strange-looking sight. Where the Navajo Sandstone loses its iconic peach, orange and red stripes, hundreds of round, iron-coated stones often litter the ground.

The stony spheres are concretions — sandstone balls cemented by a hard shell of iron oxide minerals. Often called moqui marbles, acres of the chocolate-colored rocks are scattered across Utah and Arizona. They tumble from the pale, cream-colored Navajo Sandstone beds, when wind and water wash away the softer rock.

For decades, the rocks were simply a geological oddity. Then, look-alikes were discovered on Mars (the so-called Martian blueberries). The milestone — among the early evidence for water on Mars — boosted interest in Earth’s iron baubles. [Photo Gallery: See Fantastic Moqui Marbles]

Now, a new study reveals that the moqui marbles are no more than 25 million years old — a sharp contrast to the 190-million-year-old Navajo Sandstone. Marbles scattered on sandstone slopes in Grand Staircase-Escalante National Monument are only 2 million to 5 million years old. And on Arizona’s Paria Plateau, the marbles’ iron oxide rind is as young as 300,000 years old, researchers report in the September 2014 issue of the Geological Society of America Bulletin.

“They really represent a record of how water moved the rock millions of years ago, and the next generation can use them to understand water and life on other planets,” said Marjorie Chan, co-author of the new study and a geologist at the University of Utah in Salt Lake City.

Odd balls

The moqui marbles’ precise ages come from a radioactive clock. The iron oxide minerals contain traces of radioactive uranium and thorium, and these decay by expelling helium. Tallying the elements reveals the time since the minerals formed. The innovative technique may help resolve different models of how the stone spheres formed. Scientists agree that the iron comes from the bone-white Navajo Sandstone layers, stripped bare of their mineral paint by percolating groundwater. A subtle film of hematite, or iron oxide, colors the iconic red cliffs and canyons.

Chemical reactions fused the moqui marbles with iron, but the details haven’t been settled. Some researchers now think tiny microbes spurred the chemical process, and that similar concretions on Mars may one day reveal signs of ancient life. [The 7 Most Mars-Like Places on Earth]

“The discoveries on Mars helped push us to better understand the setting here on Earth, and what we do on Earth feeds back into helping interpret Mars,” Chan told Live Science.

Concretions of all shapes and sizes are found all over the world. The curious rocks have inspired fantastical tales of fairies, meteorites and dinosaur eggs, but their origin is fairly mundane. Water flowing through sedimentary rock leaves behind minerals that glue together masses of sand, mud or other particles. Sometimes, a treasure — like a bone or a shell — hides inside.

The moqui marbles crop up in the Navajo Sandstone in Arizona and in Utah’s public lands, eroding from the spectacular white cliffs in Zion National Park and the Grand Staircase-Escalante National Monument. Collecting concretions in the parks is prohibited.

Red and white Navajo sandstone in Zion National Park.
Red and white Navajo sandstone in Zion National Park.

Credit: National Park Service

The iron stones appear almost black, with a pitted surface polished by blowing sand. Other rusty structures formed too, including discs, “flying saucers,” pipes and flat plates. Spiritualists have endowed the marbles with “energy” and dubbed the distinctive shapes as male and female, making them among the only rocks with a gender. Quietly sitting and holding one in each hand is said to calm the spirit, just like meditation.

“I don’t believe that,” Chan said. “I do believe these are important resources, and the geologic landscape is our heritage.”

Cloaked in iron

The Navajo Sandstone was once the biggest expanse of dunes on Earth. Its color comes from flakes of iron-rich minerals blown in and buried with the quartz sand. After the dunes were blanketed and buried by younger geologic layers, the iron enrobed the sand grains, giving the Navajo Sandstone its amazing colors and patterns. [Image Gallery: Majestic Monument Valley]

Eons later, the moqui marbles were born. The concretions owe their existence to massive tectonic shifts in the Southwest, researchers think. Some 20 million years ago, the Colorado Plateau started to bob up like a cork. The entire plateau has lifted about 1.2 miles (2 kilometers).

The tectonic uplift warped its rock layers, trapping oil and gas. When a mixture of water and natural gas flowed through the Navajo Sandstone, it stripped away the rusty coating, bleaching the rocks from red to creamy white. Chan thinks this iron-rich water crept through the sandstone until it reached a crack, hole or layer where the water chemistry was different and iron settled out of the water.

The chemical reactions first covered each sand grain with iron, creating tiny spheres. The spheres grew, layer by layer, making contact with others nearby until some spheres connect into one large mass. Collectors on private property sometimes find odd, knobby clumps that appear to be partially formed spheres, where the process may have halted halfway through.

The spheres grew layer by layer, making contact with others nearby until many spheres became one large ball.
The spheres grew layer by layer, making contact with others nearby until many spheres became one large ball.

Credit: Marjorie Chan, University of Utah

“These round concretions have a self-organizing pattern, like people at a party,” Chan said. “The natural pattern is for people to gather together in conversation groups, and the groups are going to be round.”

The results of the new study suggest that the first iron-oxide batch formed 20 million to 25 million years ago, and the next set was added 2 million to 3 million years ago. This younger group matches up with another major event: It’s when the Colorado River started cutting through the Navajo Sandstone near the mouth of the Escalante River, which likely changed groundwater flow through the region. These younger marbles are mostly goethite instead of hematite, which may reflect the changing chemistry of the groundwater.

Iron eaters

The younger ages also support a different model for how the concretions formed, according to David Loope, a geologist at the University of Nebraska-Lincoln, who was not involved in the study. Loope thinks the moqui marbles were transformed by microbes, morphing from one kind of mineral to another as the region’s groundwater chemistry changed.

According to Loope’s model, the marbles were originally siderite, an iron carbonate mineral. The same fluids Chan said had bleached the sandstone deposited the carbonate spheres, only with an added boost of carbon dioxide gas dissolved in the water. When the Colorado River sliced into the Navajo Sandstone 2 million years ago, the groundwater flow and the mineral levels shifted.

The researchers think bacteria helped convert the siderite into hematite. With a powerful microscope, the researchers also discovered tiny structures suggestive of microbial life inside the concretions, similar to tubes seen in Martian meteorites. Some of the hematite rinds resemble siderite crystals — a clue that one mineral ousted the other, Loope and his colleagues reported in August 2012 in the journal Geology. “We are completely convinced the concretions had siderite precursors,” Loope said.

Link to the past

“Moqui” is a Hopi word that means “dear departed ones.” According to Hopi tradition, spirits of the dead would play with the marbles at night, leaving them behind in the morning to reassure the living that they were happy in the afterlife.

Just as the moqui marbles embody the Hopi idea of life after death, the iron stones are links to ancient environments on the Colorado Plateau. With the new dating technique, Chan has shown that scientists can start to pinpoint where and when water flowed through rock. The search for historic water routes in the Southwest has engaged researchers for more than century, since the first geologists tried to puzzle out how the Colorado River carved the Grand Canyon.

“A lot of people are just fascinated by these concretions, and maybe geologists haven’t been able to take them seriously in the past,” Loope told Live Science. “I think they pretty clearly hold a lot of information.”

Email Becky Oskin or follow her @beckyoskin. Follow us @livescience, Facebook & Google+. Original article on Live Science.

Get More from Our Newsletter
Author Bio


Becky Oskin

Becky Oskin, Contributing Writer
Becky Oskin covers Earth science, climate change and space, as well as general science topics. Becky was a science reporter at Live Science and The Pasadena Star-News; she has freelanced for New Scientist and the American Institute of Physics. She earned a master’s degree in geology from Caltech, a bachelor’s degree from Washington State University, and a graduate certificate in science writing from the University of California, Santa Cruz.