MaryAnn Dousdebes
Created June 30, 2016 © GPL3+

SCI4YOU

This project consists in the knowledge of the sensors that are either located in a cubesat or in a small satellite

IntermediateWork in progressOver 4 days86
SCI4YOU

Things used in this project

Hardware components

Capacitor 1000 µF
Capacitor 1000 µF
×1
Capacitor 10 µF
Capacitor 10 µF
×1
Resistor 10k ohm
Resistor 10k ohm
×1
SparkFun RedBot Sensor - Wheel Encoder
SparkFun RedBot Sensor - Wheel Encoder
×1
Custom fabricated PCB
OSH Park Custom fabricated PCB
×1

Software apps and online services

3DR hfss
proteus
Circuit Maker
CircuitMaker by Altium Circuit Maker

Story

Read more

Custom parts and enclosures

3d model

is a approximate vision of my project

SCI4YOU

IS AN EXPLICATION OF MY PROJECT

Schematics

Schemes

maybe i have that improve it and add other circuits , i work based in my experience

Code

Codes

C/C++
I use NXP freedom development tool, It is an attempt code , i worked with msp430 in a similar projects for my U, but is difficult do a code, if i can't to probe it
#include "mkw40z160.h"
#include "hidef.h" 
#define MCU_CLOCK           47000000
#define PWM_FREQUENCY       46      // In Hertz, ideally 50Hz.
#include "IEEE_802.15"
#define "i2c.h"
#pragma vector=TPM 1_VECTOR
int pulse = 0;
int pulse =2;
double HUM= 0;
double temp =0;
 
 //pwm
void TIMER1_init(void);

int Period = 128;
int Half_Period = 64;
int Step = 8;
int Small_Step = 1;
#define TPM0_CH3 =1;// for compare PWM with a "in" port
#definE TPM0_CNT=1 ;// TMP counter
#define TPM0_CH2=0;// Potenciometer
unsigned int PWM_Period     = (MCU_CLOCK / PWM_FREQUENCY); 
unsigned int PWM_Duty       = 0;       
unsigne PWM_OUT                    

void main(void)
{

    WDTCTL  = WDTPW + WDTHOLD;     // STOP watchdog timer
    TPM_CH3 = OUTMOD_X;            // TACCR1 reset/set
    TACTL   = TASSEL_2 + MC_1;     // SMCLK, upmode
    TPM_CNT  = PWM_Period-1;        // PWM Period
    TPM_CH2 = PWM_Duty;            // TACCR1 PWM Duty Cycle
    PTADIR   |= BIT2;               // P1.2 = output
    PTASEL   |= BIT2;               // P1.2 = TA1 output
 
}

 

   __interrupt void Timer1_0 (void) {
 
     
    if( TPM0_CNT =1 > 2980000 || TPM0_CNT < 2 )
     
    PTADIR = TPM0_CH2;
    //Program for the probability of a fire 
   

void i2c_start ();{           // send start sequence
   I2C0_A1 ==0x01            //Channerl of I2C
   AD == 0x02                //Slave chanel
   bps == 3000               // frecuency
}
void iic_smbus_init();{
   I2C0_A1 ==0x02           //Channerl of I2C
   AD == 0x03               //Slave chanel
   bps == 3000 
   sec_addr = 0x03        //SMBus
}
void i2c_master ();{
  
I2C0_A1==0x03  
I2C_TX== 0x01 //mode i2c defined in i2c.h
AD == 0x01

}


void i2c_master_TX(void)
{
  I2C_A1 == 0x01 ;

 i2c_tx_buffer.tx_index = 0;
 i2c_tx_buffer.rx_index = 0;
 i2c_tx_buffer.data_present = TRUE;
 i2c_tx_buffer.length = 64;

 i2c_tx_buffer.buf[0] = (uint8)(I2C_SLAVE_ADDR&0x0FF);
 for(i=1;i<64;i++)
{
 i2c_tx_buffer.buf[i] = i;
}
// I2C channel 3, 50000bps
i2c_init(3, I2C_MASTER_ADDR, 50000);
i2c_master(3, I2C_TX, I2C_SLAVE_ADDR)
void main {
                 
void i2c_master_RX_test(void)
{
 I2C_A1 == 0x01 i;

i2c_rx_buffer.length = 64;
i2c_init(0, I2C_MASTER_ADDR, 50000);
i2c_master(0, I2C_RX, I2C_SLAVE_ADDR);

}
void temperature ();
{ 
if P1IN & 0x01 == 0x01
      tpw +=1
 else
       tf +=1
 end 
}
     
}

void Encoder ();
{ 
  while (P2IN & 0x01) == 0x01 )        //Pregunto si pulse el pulsador 1
   { 
     ENCODER +=1
     P2OUT = ENCODER 

    }  
           


while   (P2IN & 0x01) == 0x01) // if a device is on
 

 i2c_tx(0xE0);             // STPFO I2C address with R/W bit clear
 i2c_tx(0x01);             // STPFO light sensor register address
 i2c_start();              // send a restart sequence
 HUM =-6+125(tpw/tf)       //conversion 
 HUM=i2c_rx(1);          // get HUMIDITY sensor and send acknowledge. Internal                                  register address will increment automatically.
 ENCODER =i2c_1rx(1) 
 delay(5000);
void temperatura  (); 
{for i=0; i<=50000; i++
    P1out & 0x03 == 0x01 //SDK of htu21t sensor
     temp = -46.85+175.72x(tpw/tf)
     temp = i2c_2rx(1);
 end    
   
}
//GIROSCOPE PROGRAM
unsigned char reg_val = 0;  
              
   I2C_WR(FXAS21002_I2C_ADDRESS, CTRL_REG1, 0x40);      // Reset all registers to POR values  
              
   Pause(0x631);                                                   // ~1ms delay  
                          
   do                                                              // Wait for the RST bit to clear   
   {  
        reg_val = I2C_ReadRegister(FXAS21002_I2C_ADDRESS, CTRL_REG1) & 0x40;   
   }    while (reg_val);  
              
   I2C_WR(FXAS21002_I2C_ADDRESS, RT_THS_REG, 0x05);     // Set threshold to 96 dps           
   I2C_WR(FXAS21002_I2C_ADDRESS, RT_COUNT_REG, 0x02);   // Set debounce timer period to 20 ms  
   I2C_WR(FXAS21002_I2C_ADDRESS, RT_CFG_REG, 0x0B);     // Enable rate threshold detection for X and Y axis, latch enabled   
              
   I2C_WR(FXAS21002_I2C_ADDRESS, CTRL_REG2, 0x30);      // Rate threshold interrupt enabled and routed to INT1  
   I2C_WR(FXAS21002_I2C_ADDRESS, CTRL_REG1, 0x0E);      // ODR = 100 Hz, Active mode     
   void PORTA_IRQHandler()  
{  
   PORTA_PCR5 |= PORT_PCR_ISF_MASK;                                   // Clear the interrupt flag   
   IntSource = I2C_ReadRegister(FXAS21002_I2C_ADDRESS, RT_SRC_REG);   // Read the RT_SRC register to clear the EA flag and deassert the INT1 pin            
   EventCounter++;     
   RT_SRC=i2c_3rx
}  

rangehigh = i2c_rx(1);    // get the high byte of the range and send acknowledge.
rangelow = i2c_rx(0);     // get low byte of the range - note we don't acknowledge the last byte.
rangehigh = i2c_1rx(1);    // get the high byte of the range and send acknowledge.
rangelow = i2c_1rx(0);     // get low byte of the range - note we don't acknowledge the last byte.
rangehigh = i2c_2rx(1);    // get the high byte of the range and send acknowledge.
rangelow = i2c_2rx(0);     // get low byte of the range - note we don't acknowledge the last byte.

i2c_stop()== 0x01;               // send stop sequence


//Program for a Bluetooth
TIME_CONTROL =1000 //Configuration comunication velox
Adc_INTR_CLEAR = 0x01 //
INIT_INTERVAL = 0x01// 
ADV_DIRECT_INT = i2c_rx(1)&& i2c_1rx(1)&& i2c_2rx(1)&& p1out
RX_ADDR= ADVDIRECT_INT


}

                          






}
    
 

       

}


 
	

Credits

MaryAnn Dousdebes
2 projects • 3 followers

Comments