NASA Space Apps Challenge 2017
Technical Report
Team name : The Horde
Challenge : You’re my sunshine
-Table of content:
1) Abstract
Solar power nowadays plays a very critical role whether on Earth or Space. This power will allow the spacecraft to remain in orbiting for months at a time. The aim is to make spacecraft crew understand solar power generated from panels in space and help them control the power during their mission.
2) Idea
Nasa needs to create a medium to make people who have no knowledge with solar panels, so we created a game with simple design to make people understand output power from solar panels.
We took in our consideration many things as :
1)Position of solar panel on earth.
2)tilt and degree of rotation for solar panel.
3)weather of the day ( cloudy or dusty ).
We displayed our game in way to make people from different ages get understand concept of output solar panel in the easiest way.
3)Tool
Nasa needs to plan their daily need from power in space so we tried to make our solution with best logic solutions.
We depends on power of our system in space so we have to get adapted with it through letting astronaut entering what he needs in space devices as laptops or gyms device, Also he must enters duration for the devices he want to use in order to monitor power consumption according to some rules to calculate power consumption and power rest to complete his mission through his way.
4) How to accomplish it:
we depend on several conditions:
1)if there an object passes in front of sun so the dependence on solar power decreased a lot so there is a system which will react with this condition.
In way to warn astronauts from dangerous of leaking of power through some days
So the system react through it decrease the not important devices connected and leave the essential devices as oxygen device.
2) if the solar panel got damaged from outer environment ,so it has to warn astronaut from this dangerous and get action as decrease power consumption for spacecraft by shutting down the less important devices which we can operate it in different time after getting out from this dangerous situation.
3) also we are getting data from websites as weather (cloudy-dusty), so we depend on data on from websites through esp module.
----------------------------------------------------------------------
Code
#include <LiquidCrystal.h>
#include <Keypad.h>
const byte Rows= 4; //number of rows on the keypad i.e. 4
const byte Cols= 4; //number of columns on the keypad i,e, 3
//we will definne the key map as on the key pad:
char keymap[Rows][Cols]=
{
{'1', '2','3' , 'A'},
{'4', '5','6' , 'B'},
{'7','8','9','C'},
{'*','0','#','D'},
};
// a char array is defined as it can be seen on the above
//keypad connections to the arduino terminals is given as:
byte rPins[Rows]= {A5,A4,A3,A2}; //Rows 0 to 3
byte cPins[Cols]= {A1,A0,6,7}; //Columns 0 to 2
// command for library forkeypad
//initializes an instance of the Keypad class
Keypad kpd= Keypad(makeKeymap(keymap), rPins, cPins, Rows, Cols);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
/****************************/
//LCD
/******************************/
float Lampspower = 0.5;
float laptoppower = 0.3;
int Machayapower = 4;
int microwavepower =3 ;
int solarpower = 50;
int oxygen = 2;
float poweroxygen;
float spacedevices[] = {Lampspower,laptoppower,Machayapower,microwavepower,solarpower};
char devicesinputs[]={};
char devicesinputstime[]={};
int differenceoutput;
int done;
char number_of_devices;
int timearrival=20;
float powerconsumption1;
float powerconsumption2;
float powerconsumption3;
int totalconsumption;
int timeneeded;
char keypressed = '1' ;
char choose3;
void setup() {
Serial.begin(9600);
/******************/
//LCD
}
void loop() {
//************* # of devices
lcd.setCursor(0,0);
lcd.println("choose 1-5:");
delay(300);
while(1){
char keypressed = kpd.getKey();
if (keypressed != NO_KEY)
{
number_of_devices=keypressed;
lcd.setCursor(5,1);
lcd.print(keypressed);
break;
Serial.println(keypressed);
}
}
delay(300);
Serial.println(number_of_devices);
//*********************************
for(int i=0;i<number_of_devices;i++)
{
lcd.clear();
lcd.setCursor(0,0);
delay(300);
lcd.print("select devices");
delay(200);
Serial.println(i);
while(1){
char keypressed = kpd.getKey();
delay(300);
if (keypressed != NO_KEY)
{
devicesinputs[i] = keypressed;
break;
}
}
}//end for loop
for(int y =0;y<5;y++){
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Devices are");
lcd.setCursor(y,1);
lcd.print(devicesinputs[y]);
delay(200);
}
//*********************** # of hours
for(int z=0;z<number_of_devices;z++)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Enter time");
while(1){
char keypressed = kpd.getKey();
if (keypressed != NO_KEY)
{
devicesinputstime[z] = keypressed;
break;
}
}
}//end for loop
poweroxygen=timearrival*oxygen;
float oxygenpercent=(poweroxygen/solarpower)*100;
//******
lcd.clear();
lcd.setCursor(0,0);
lcd.print("oxygen percent:");
delay(200);
lcd.setCursor(0,1);
lcd.print(oxygenpercent);
delay(200);
lcd.print("%");
delay(200);
//***********
int restpowerffromesstinital=solarpower-poweroxygen;
lcd.clear();
lcd.setCursor(0,0);
delay(200);
lcd.print("remained power after using oxygen system ");
delay(200);
lcd.setCursor(0,1);
lcd.print(restpowerffromesstinital);
lcd.print("1st Device consumption");
//*******************
powerconsumption1=devicesinputstime[0]*spacedevices[devicesinputs[0]];
lcd.clear();
lcd.setCursor(0,0);
lcd.print(powerconsumption1);
lcd.print("2nd device consumption");
//*********************
powerconsumption2=devicesinputstime[1]*spacedevices[devicesinputs[1]];
lcd.print(powerconsumption2);
powerconsumption3=devicesinputstime[2]*spacedevices[devicesinputs[2]];
lcd.print(powerconsumption3);
totalconsumption=powerconsumption1+powerconsumption2+powerconsumption3;
int remainedpower=restpowerffromesstinital-totalconsumption;
if(remainedpower<0)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("you cant operate them all ");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" choose between them");
//*************
int hoursfirstdevice=restpowerffromesstinital/spacedevices[devicesinputs[0]];
int hoursseconddevice=restpowerffromesstinital/spacedevices[devicesinputs[1]];
int hoursthirddevice = restpowerffromesstinital/spacedevices[devicesinputs[2]];
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("first device operates for");
lcd.setCursor(0,1);
lcd.print(hoursfirstdevice);
lcd.setCursor(5,1);
lcd.print("h");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("second device operates for");
lcd.setCursor(0,1);
lcd.print(hoursseconddevice);
lcd.setCursor(5,1);
lcd.print(" h");
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("your second device will operate for");
lcd.print(hoursthirddevice);
lcd.print(" h");
delay(1000);
lcd.clear();
lcd.print("dev[0],dev[1],dev[2]");
keypressed =kpd.getKey();
if (keypressed != NO_KEY)
{
choose3 = keypressed;
}
if(choose3=='0')
{
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" you selected first ");
}
else if(choose3=='1')
{delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" you selected second ");
}
else if(choose3=='2')
{
delay(1000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" you selected second ");
}
}
else
{
lcd.print("your devices can operate succefully ");
}
//lcd.print("remained power is ");
//lcd.print(remainedpower);
}
SpaceApps is a NASA incubator innovation program.