Please Design an application that runs on a BeagleBone Black

Please Design an application that runs on a BeagleBone Black divice which utilizes an LM34/MCP9701 temperature readings.(Please note Analog input pins requirementwith regard to BBB and currents.1.8 Volts is the max for these pins not 3.3 Volts .The Application should utilizes the temperature readings obtained from the sensor and present both Fahreinheit and CelisiusPlease runs the application for 3 minutes while logging the temperature readings at regular interval 10 seconds .Write structure code using python 3.4.4

Solution

in python :

nanotmp36.py

import Adafruit_BBIO.ADC as ADC
import time

sensor_pin = \'P9_40\'

ADC.setup()

while True:
    reading = ADC.read(sensor_pin)
    millivolts = reading * 1800 # 1.8V reference = 1800 mV
    temp_c = (millivolts - 500) / 10
    temp_f = (temp_c * 9/5) + 32
    print(\'mv=%d C=%d F=%d\' % (millivolts, temp_c, temp_f))
    time.sleep(1)

Save and exit the editor using CTRL-x and the Y to confirm.

To start the program, enter the command:

You will then see a series of readings. :

mv=757 C=25 F=78
mv=760 C=26 F=78
mv=762 C=26 F=79
mv=765 C=26 F=79
mv=763 C=26 F=79
mv=763 C=26 F=79
mv=766 C=26 F=79
mv=768 C=26 F=80

in C

#include \"MCP9701E.h\"

#include <stdlib.h>

#include <fcntl.h>

#include <stdio.h>

#include <unistd.h>

/// Input voltage

const float MCP9701E::Vdd = 3.3;

/// Maximum and minimum values that can be measured

const int MCP9701E::TempSensorMin = 0;

const int MCP9701E::TempSensorMax = 4096;

/// Temperature sensor constants

const float MCP9701E::V0 = 0.3f;

const float MCP9701E::Tc = 0.0195f;

/// Handles a MCP9701E temperature sensor

///

/// @param Hardware device to read the temperature measurements from

MCP9701E::MCP9701E(const char *pin)

{

_input = open(pin, O_RDONLY);

}

/// Grabs a temperature measurement

float MCP9701E::GetTemperature()

{

// Read the sensor

int status = read(_input, _buffer, sizeof(_buffer));

if (status == -1)

{

fprintf(stderr, \"ERROR: Could not get temperature measurement.\");

return -999.0f;

}

// Reset the sensor

lseek(_input, 0, 0);

// Convert the string into an integer

_buffer[status] = \'\\0\';

int value = atoi(_buffer);

           

// Convert the measurement into a temperature

float voltage = ((float) value) / (TempSensorMax - TempSensorMin + 1) * Vdd;

float temp = (voltage - V0) / Tc;

return temp;

}

/// Closes the temperature sensor

void MCP9701E::Close()

{

if(_input != -1)

{

close(_input);

_input = -1;

}

}

Please Design an application that runs on a BeagleBone Black divice which utilizes an LM34/MCP9701 temperature readings.(Please note Analog input pins requireme
Please Design an application that runs on a BeagleBone Black divice which utilizes an LM34/MCP9701 temperature readings.(Please note Analog input pins requireme
Please Design an application that runs on a BeagleBone Black divice which utilizes an LM34/MCP9701 temperature readings.(Please note Analog input pins requireme

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site