Shuttle and plane

Reproduce the aviation miracle in human history.

shuttle & plane

Team members


Description

We are trying to make the interactive model of two aircrafts: Blizzard space shuttle, the only space shuttle that’s not made in US and Antonov 225 carrier, the biggest airplane human ever filed into the sky. Our target users are parents searching for cool toys for their children. This set of aircrafts is the perfect Christmas present for your kids.
The An-225 carrier was designed to carry the space shuttle around. That’s where the interaction will happen. The light animation will change when the two air crafts are separate or connected. All the ports will be hidden in the flipping head of both crafts. That’s how An-225 opens its cargo space. There will be one button hidden on the back of each aircraft.


System Diagram


an225

shuttle

Implementation

(See details in section “Software” and “Video”)

An225

Connection changes animation mode


We used analog signal to detect connection status. If the connection status is changed, the voltage on the analog input pin will change. In the main loop, we will measure the voltage to determine if the two parts are connected or not. If the two parts are connected, the Neopixels will work in flow animation mode. If they are not connected, the Neopixels will fade together.
Button changes color

The button for an225 works in blocking mode. We will monitor the button status in the main loop. If a push is detected, a handler function will change the color of the Neopixels. Those colors are coded into the chip.

Shuttle


Connection changes led frequency
While connected, the frequency of the led (no matter blink or fade) will double. It will go back to normal speed after departure.
Button changes animation mode
The button for shuttle works in interrupt mode. While the button is pushed, an external interrupt will be triggered. A handler function will process the button push and change the parameter that controls the animation mode between blink and fade.


Schematics Layouts

schematic.png

Software

Connector

We used the slide connectors in our project. It’s a two-pin connection. To achieve the bi-directional communication only using two pins, we decided to use analog signal instead of digital signal. That’s because analog signal has more than 2 states in one pin. We connected one digital output GPIO and one analog input GPIO together through a 470Ohm resister. And use one pin of the connector to build the common grand. And use the other pin to connect the two analog input pins. We will analyze this connection method according to the three connection states.

  • Separate
    When separate, the voltage on the analog input pin of an225 board is 3.3V. And voltage on the input pin of shuttle board is 0V. (Please refer to the main circuit schematic)
  • Connected
    connected

    When the two boards are connected, the voltage on both analog pins will change to ~1.65V. This is a significant change for the 10bit ADC of Arduino. Therefore, both boards can detect the connection.
  • Misconnected (reversed)
    misconnected

    Our physical design does not prevent the misconnection from happening (shuttle’s head towards plane’s tail). But our circuit will protect the two boards. When this happens, the voltage between A0_an225 and GND1 will be 1.65V. This is safe for the board and will trigger the connection event for an225’s board. The voltage between A0_shuttle and GND2 will be -1.65V. According to the GPIO design of Atmega 328P shown in the schematic below, the protection diode will work and there will be a negative current through the A0 port. However, since we have a resistor protecting between the analog port and digital port, the current will be limited in a safe range. Therefore, our boards won’t burn under misconnection.
    GPIO

System clock

The main loop for feather board is running at 50Hz precisely since I used the Timer to generate a 50Hz interrupt. And I can not find the handbook showing Timer usage for the CPX board. So, the main loop for the CPX board is running a little bit under 50Hz because I put a 20ms delay in the end of the loop. For the feather board’s main loop, the tasks are detecting connection using the analog pin and changing the led brightness using two PWM pin. The button is running on interrupt mode too. For the CPX board’s main loop, monitoring the button is one of the tasks too.

Button

We used D6 on CPX and D2 on feather as button pins. Both the button pins are set to Input_Pullup mode. An external interrupt is attached to the D2 pin to monitor the falling edge. I used the main clock of Arduino to avoid voltage shaking of the button pin. The program will only accept the falling edge happened 25ms after the last one. The button will change the mode parameter for the LEDs. The D6 pin on CPX is monitored in the main loop directly. Since the gap between two cycles is more than 20ms, I did not apply any anti-shake method for this one. This button will change the color of the Neopixels.

Neopixel

The Neopixels are connected to D8 according to the instruction. And I used the adafriutNeopixel library to drive those dots. While not connected, the dots will fade together. While connected, the dots will fade in sequence to create a flow animation. The colors of those dots are saved in a long int array. And pushing the button will change the color.

LED

I used the led connected to the serial chip in this project since the led connected with D13 is in the corner and hard to reach. I cut the copper connecting the serial chip and the LEDs, and the copper connecting the 5V net and the LED positives. I flied the 3V3 onto the positives and D9, D10 onto the negatives instead. Those two pins can be multiplexed as PWM output pins and will not conflict with the Timer2 running the main loop. The connection will change the frequency of those LEDs. And the button will change the mode between blink and fade.

Code for an225

//Library for the NeoPixels
#include <Adafruit_NeoPixel.h>

//Colors in RGB format
long int colors[7] = {0xf44336, 0x9c27b0, 0x3f51b5, 0x00bcd4, 0x4caf50, 0xffeb3b, 0xff5722};
long int ledColor = colors[0];
int colorIndex = 0;

/*
buttonHandler
Change the led color while push the button
*/
void buttonHandler()
{
  colorIndex++;
  if (colorIndex >= 7)
  {
    colorIndex = 0;
  }
  ledColor = colors[colorIndex];
}

/*
setColor
parameters:
long int color: Color value storaged in RGB format
int mode: Fade mode or animation mode
int ledCounter: the progress of the animation
This function changes the color of the NeoPixels
*/
Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, 8, NEO_GRB + NEO_KHZ800);
void setColor(long int color, int mode, int ledCounter)
{
  //Get the RGB value of the color
  int colorR = (color & 0x00FF0000) >> 16;
  int colorG = (color & 0x0000FF00) >> 8;
  int colorB = (color & 0x000000FF);
  //Calculates the brightness under fade mode and change the color.
  if (mode == 1)
  {
    int fade = abs(100 - ledCounter);
    colorR = colorR * fade / 100;
    colorG = colorG * fade / 100;
    colorB = colorB * fade / 100;
    int i = 0;
    for (i = 0; i != 10; i++)
    {
      strip.setPixelColor(i, strip.Color(colorR, colorG, colorB));
    }
  }
  //Calculaes the brightness under animation mode and change the color
  else
  {
    int i = 0;

    for (i = 0; i != 5; i++)
    {
      int fade = abs(100 - (ledCounter + 40 * i) % 200);
      int colorRtemp = colorR * fade / 100;
      int colorGtemp = colorG * fade / 100;
      int colorBtemp = colorB * fade / 100;
      strip.setPixelColor(i, strip.Color(colorRtemp, colorGtemp, colorBtemp));
      strip.setPixelColor(9 - i, strip.Color(colorRtemp, colorGtemp, colorBtemp));
    }
  }
  //display
  strip.show();
}

//Setup
#define button 6
void setup()
{
  Serial.begin(115200);
  pinMode(button, INPUT_PULLUP);
  pinMode(10, OUTPUT);
  digitalWrite(10, LOW);
  strip.begin();
  strip.show();
}

int ledCounter = 0;
int previewsButton = 1;
#define Connected 1
#define DisConnected 0
int connectStatus = DisConnected;

/*
main loop
*/
void loop()
{
  //Change the led counter.
  ledCounter += 4;
  if (ledCounter >= 200)
  {
    ledCounter = 0;
  }
  //Monitor the button
  if ((previewsButton == 1) & (digitalRead(button) == 0))
  {
    buttonHandler();
  }
  previewsButton = digitalRead(button);
  //Monitor the connector
  int adcValue = analogRead(A2);
  if (adcValue > 100)
  {
    connectStatus = DisConnected;
  }
  else
  {
    connectStatus = Connected;
  }
  //Setup the color accordingly
  setColor(ledColor, connectStatus, ledCounter);
  //delay 20ms
  delay(20);
}

Code for shuttle

//The Timer library for generating the 50Hz intterrupt for mian loop
#include <MsTimer2.h>

//define Pins for ports
#define LED1 9
#define LED2 10
#define button 2
#define connector 7

//LED opration mode
#define blinkMode 0
#define fadeMode 1
int ledMode = blinkMode;

//parameters for fading 
int ledCounter = 0;
int ledDirection = 0;

//LED operation speed
#define speedFast 2
#define speedSlow 1
int ledSpeed = speedSlow;

/*Button handler
Use the main clock (millis()) to avoid button shaking
Only accepts falling edge happens more than 25ms after the last one.
Use 1ms delay to avoid button shaking while release the button.
*/
unsigned long previousMillis = 0;
void buttonHandler()
{
  unsigned long currentMillis = millis();
  if ((currentMillis - previousMillis) > 25)
  {
    delay(1);
    if (digitalRead(button) == 0)
    {
      Serial.println("button pushed");
      ledMode = !ledMode;
    }
  }
  previousMillis = currentMillis;
}

/*
Mainloop function
This function is the handler for the 50Hz timer interrupt.
Use adc to determine if the two parts are connected or not.
Than change the opration mode and speed accordingly.
Finnaly change the brightness of both LEDs.
*/
void mainTask()
{
  //Get the connnection status
  int adcValue = analogRead(A0);
  if (adcValue > 900)
  {
    ledSpeed = speedSlow;
  }
  else
  {
    ledSpeed = speedFast;
  }
  //Calculate fade value
  if (ledDirection == 0)
  {
    ledCounter += ledSpeed;
    if (ledCounter >= 50)
    {
      ledDirection = 1;
    }
  }
  else
  {
    ledCounter -= ledSpeed;
    if (ledCounter <= 0)
    {
      ledDirection = 0;
    }
  }
  //Change the brightness according to the opration mode.
  if (ledMode == blinkMode)
  {
    if (ledCounter >= 25)
    {
      analogWrite(LED1, 255);
      analogWrite(LED2, 255);
    }
    else
    {
      analogWrite(LED1, 0);
      analogWrite(LED2, 0);
    }
  }
  else
  {
    int fadeValue = ledCounter * 4 + 5;
    analogWrite(LED1, fadeValue);
    analogWrite(LED2, fadeValue);
  }
}

/*
Set up
*/
void setup()
{
  //Set pin mode for leds and buttons
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(connector, OUTPUT);
  pinMode(button, INPUT_PULLUP);
  //Attach external interrupt for the button
  attachInterrupt(digitalPinToInterrupt(button), buttonHandler, FALLING);
  digitalWrite(connector, HIGH);
  //Set up timer interrupt
  MsTimer2::set(20, mainTask);
  MsTimer2::start();
}

//No need for the blocked main loop
void loop()
{
}


Gallery


Video

Youtube
优酷


Process

Iteration 1: Finding out the scope of our project.

From the beginning, we know that our big plane is going to be huge. We need to figure out how big it should be. So, we used foam to cut out the first iteration of our project. The limitation are the circuit boards and the scaling relation between the two aircrafts. We want to make the plane as small as possible while the whole thing is not ugly. The scale is defined by the feather board. From the feather board, we get the minimum size of our space shuttle. And according to the scale, we get the minimum size of our big plane. Those foam prototypes helped a lot in the future modeling work.

Iteration 2.1: Test the tolerance of F170


We decided to use slide connectors to connect the two parts. Since our plane is going to be huge and the 3D printing resource is limited, we printed out all the connectors first to test the tolerance. We also printed out the head with a clip on the bottom side to test if it would work. The results are really helpful. The slide connectors succeeded the first time. We used the same design for the last version. However, we find out that the bottom clip can not work because that structure requires a large deformation to work and the material is not resilient enough.

Iteration 2.2: Light guide test


None of us has used light guide before. There were a lot to learn. We used acrylic to cut out our light guides for its high transparency. We tested two things here: 1) Is the lens structure helpful for collecting the light? 2) What’s the minimum diameter of the arc on the light guide that’s acceptable. We printed out several lightguides shown in the picture and tested them using the NeoPixels on the CPX board. Turned out the lens do help, and the minimum diameter is around 10 mm. Those details are integrated into our final design to make it better.



To hold the light guides properly insight the body. We designed a set of light guide holder. We used cardboard to do that because carboards are more flexible. It will deform under tight fit and can hold itself and the light guides in position.

Iteration 3: Test prints for the space shuttle

The first print

We modeled the space shuttle first to further test our designs. Though the two aircrafts vary a lot in shape and scale, they have the same design details. And it is easier to test those details on the smaller one. F170 went into some trouble during the first print and the print was not finished. However, those unfinished parts were still helpful to us. We made sure the switch would fit. And we changed the position for the circuit board. The second test print also did not go well due to changing the material on half. The separate lines for those two materials were fragile. We managed to change the design details and modeled both the aircrafts in the end.

Iteration 4: Final print


Thanks to all the test prints and all the experience we got, the final print succeeded for the first time. Almost all the details worked well except for one of the clips on the big plane. But that one is trivial. One funny thing is that since the parts are too large and there is too much support material, our parts were in the wash tank for too long. And water got into every corner of the infill. We shake those parts crazy for hours to get the water out.


Post-process & painting:



We finished the print job early. So, we decided to make the aircrafts look better.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,242评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,769评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,484评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,133评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,007评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,080评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,496评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,190评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,464评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,549评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,330评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,205评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,567评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,889评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,160评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,475评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,650评论 2 335

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,251评论 0 10
  • 《 穿越恋》 “呃,怎么了?”素罗醒来时已经躺在了床 上,“这是哪里,怎么回事?我不是死了吗?”素罗是一个初中生,...
    许子静阅读 172评论 0 1
  • 日暮昏黄闻雪声 北风吹落雪纷纷 哥嫂相邀踏雪山 处处有雪落满身 翠竹抖落一身云 门前茅屋雪色深
    X小李姑娘阅读 212评论 0 2
  • 六月几乎所有的时间都浪费掉了,不知道自己目标是什么,做了事但毫无效率,所幸在最后的两天突然醒悟。 工作上: 1.上...
    楠希雅格阅读 184评论 0 0