0

Newb.. With Questions
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Newb.. With Questions

by Blue_Ice on Wed Dec 30, 2015 3:24 pm

I'm completely confused on what board to even start with. So i will post my project and hope someone can give me some guidance.

I want to build a digital type dash for a motorcycle.
using Adafruit 1.2" 4-Digit 7-Segment Display w/I2C Backpack as my outputs in the display
in this case there will be 6 of the seven segment displays. I understand they run on I2C and you can chain them so is it safe to say that i can run this on many different boards?

im going to be using gps to collect speed data and mileage datato send to display
along with this i have common needs such as tach input and oil pressure and temp as well as fuel inputs.
all these will have to constantly update so the question is what board can handle this much input and output and do the calculations fast enough ?

I'm new to this and not sure where to start..
I am using standard automotive senders i assume are resistance based that change ohms on different levels can this be input into these boards or do i need some kind of ADC ?
thanks in advance
as i have many questions
Last edited by Blue_Ice on Tue Feb 23, 2016 11:21 pm, edited 1 time in total.

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Wed Dec 30, 2015 3:57 pm

there will be 6 of the seven segment displays. I understand they run on I2C and you can chain them so is it safe to say that i can run this on many different boards?

The backpacks are addressible so you can have as many as 8 of them on the i2c bus.

A 32U4-based processor such as the Feather 32u4 should be able to handle your sensors. It has 6 analog inputs in addition to I2C and digital i/o pins.
https://learn.adafruit.com/adafruit-fea ... o/overview

adafruit_support_bill
 
Posts: 74951
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Wed Dec 30, 2015 4:05 pm

thanks for the input on the Feather 32u4 , I'm learning more as I go .. and appreciate any help given..

I assume that almost any of the ardunio or rasberrypi will work in this instance as far as processing power and outputs go.. I think there will be alot of data going on parsing of gps files to gather speed and distance traveled and storing the odometer readings.. i have searched the forums and see a few reference but they are very old..

thanks again on the input.

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Wed Dec 30, 2015 4:33 pm

I assume that almost any of the ardunio or rasberrypi will work in this instance as far as processing power and outputs go.

For processing power and outputs, yes. Inputs is another story.
The Pi doesn't have any native ADC pins. You would need to add something like an ADS1115 breakout to get analog channels.
The Arduino UNO (and other Atmega 328-based compatibles) has 6 analog input pins. But 2 of them are shared with the i2c bus. So if you are using i2c, you only have 4 analog pins available. The 32U4 processor as used on the Leonardo, Feather and other compatibles, has all 6 analog pins available - in addition to the i2c bus.

You implied that you had a number of analog sensors, so I suggested the 32U4 Feather. Although any of the 32U4-based compatibles should work as well. M0-based processors should also work: https://learn.adafruit.com/adafruit-fea ... to/pinouts

adafruit_support_bill
 
Posts: 74951
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Thu Dec 31, 2015 9:25 am

Support_Bill,

Thanks for the additional input. I appreciate it all.. I will go order a few things and see what I can do..

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 22, 2016 9:30 pm

Ok I am somewhat up and running. I have the 7seg displays wired and can get basic info on them such as a static number etc.

i have a one wire temp sensor DS18B20 that i can get data out of i see it on the serial monitor. Now Im trying to send that data to my 7SEG and Im lost. can anyone help? I get error on the matrix print in function. not sure where to go i been reading for ever and cant seem to get it right. I fear im doing it wrong..

i'll post code i been modifying.. i know there is extra in it but im still learning.

Thanks in advance
Dave

Code: Select all | TOGGLE FULL SIZE
// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>

 // for led backpack
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_7segment matrix = Adafruit_7segment();

// Data wire is plugged into port 8 on the Arduino
#define ONE_WIRE_BUS 8

// Setup a oneWire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

// arrays to hold device address
DeviceAddress insideThermometer;

/*
 * Setup function. Here we do the basics
 */
void setup(void)
{
  // start serial port
  Serial.begin(9600);
  Serial.println("Dallas Temperature IC");

  // locate devices on the bus
  Serial.print("Locating devices...");
  sensors.begin();
  Serial.print("Found ");
  Serial.print(sensors.getDeviceCount(), DEC);
  Serial.println(" devices.");

  // report parasite power requirements
  Serial.print("Parasite power is: ");
  if (sensors.isParasitePowerMode()) Serial.println("ON");
  else Serial.println("OFF");
 
  // Assign address manually. The addresses below will beed to be changed
  // to valid device addresses on your bus. Device address can be retrieved
  // by using either oneWire.search(deviceAddress) or individually via
  // sensors.getAddress(deviceAddress, index)
  // Note that you will need to use your specific address here
  //insideThermometer = { 0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0 };

  // Method 1:
  // Search for devices on the bus and assign based on an index. Ideally,
  // you would do this to initially discover addresses on the bus and then
  // use those addresses and manually assign them (see above) once you know
  // the devices on your bus (and assuming they don't change).
  if (!sensors.getAddress(insideThermometer, 0)) Serial.println("Unable to find address for Device 0");
 
  // method 2: search()
  // search() looks for the next device. Returns 1 if a new address has been
  // returned. A zero might mean that the bus is shorted, there are no devices,
  // or you have already retrieved all of them. It might be a good idea to
  // check the CRC to make sure you didn't get garbage. The order is
  // deterministic. You will always get the same devices in the same order
  //
  // Must be called before search()
  //oneWire.reset_search();
  // assigns the first address found to insideThermometer
  //if (!oneWire.search(insideThermometer)) Serial.println("Unable to find address for insideThermometer");

  // show the addresses we found on the bus
  Serial.print("Device 0 Address: ");
  printAddress(insideThermometer);
  Serial.println();

  // set the resolution to 9 bit (Each Dallas/Maxim device is capable of several different resolutions)
  sensors.setResolution(insideThermometer, 9);
 
  Serial.print("Device 0 Resolution: ");
  Serial.print(sensors.getResolution(insideThermometer), DEC);
  Serial.println();

// backpack function setup
#ifndef __AVR_ATtiny85__
  Serial.begin(9600);
  Serial.println("Oil Temp Test");
#endif
  matrix.begin(0x75);
 
}

// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
  // method 1 - slower
  //Serial.print("Temp C: ");
  //Serial.print(sensors.getTempC(deviceAddress));
  //Serial.print(" Temp F: ");
  //Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit

  // method 2 - faster
  float tempC = sensors.getTempC(deviceAddress);
  Serial.print("Temp C: ");
  Serial.print(tempC);
  Serial.print(" Temp F: ");
  Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
}
/*
 * Main function. It will request the tempC from the sensors and display on Serial.
 */
void loop(void)
{
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.print("Requesting temperatures...");
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.println("DONE");
 
  // It responds almost immediately. Let's print out the data
  printTemperature(insideThermometer); // Use a simple function to print out the data

  // print with print/println
    {
    matrix.println(insideThermometer);
    matrix.writeDisplay();
    delay(10);
  }
}

// function to print a device address
void printAddress(DeviceAddress deviceAddress)
{
  for (uint8_t i = 0; i < 8; i++)
  {
    if (deviceAddress[i] < 16) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);
  }
}

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Fri Jan 22, 2016 9:45 pm

I get error on the matrix print in function.

It would be helpful if you posted the text of the error message.

adafruit_support_bill
 
Posts: 74951
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 22, 2016 9:51 pm

I think i have a few... im sorry
Arduino: 1.6.7 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\Dave\Documents\Arduino\OilTempTest\OilTempTest.ino: In function 'void loop()':

OilTempTest:125: error: call of overloaded 'println(DeviceAddress)' is ambiguous

matrix.println(insideThermometer);

^

C:\Users\Dave\Documents\Arduino\OilTempTest\OilTempTest.ino:125:37: note: candidates are:

In file included from C:\Users\Dave\Documents\Arduino\OilTempTest\OilTempTest.ino:7:0:

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:142:8: note: void Adafruit_7segment::println(char, int) <near match>

void println(char, int = BYTE);

^

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:142:8: note: no known conversion for argument 1 from 'DeviceAddress {aka unsigned char [8]}' to 'char'

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:143:8: note: void Adafruit_7segment::println(unsigned char, int) <near match>

void println(unsigned char, int = BYTE);

^

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:143:8: note: no known conversion for argument 1 from 'DeviceAddress {aka unsigned char [8]}' to 'unsigned char'

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:144:8: note: void Adafruit_7segment::println(int, int) <near match>

void println(int, int = DEC);

^

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:144:8: note: no known conversion for argument 1 from 'DeviceAddress {aka unsigned char [8]}' to 'int'

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:145:8: note: void Adafruit_7segment::println(unsigned int, int) <near match>

void println(unsigned int, int = DEC);

^

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:145:8: note: no known conversion for argument 1 from 'DeviceAddress {aka unsigned char [8]}' to 'unsigned int'

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:146:8: note: void Adafruit_7segment::println(long int, int) <near match>

void println(long, int = DEC);

^

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:146:8: note: no known conversion for argument 1 from 'DeviceAddress {aka unsigned char [8]}' to 'long int'

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:147:8: note: void Adafruit_7segment::println(long unsigned int, int) <near match>

void println(unsigned long, int = DEC);

^

C:\Users\Dave\Documents\Arduino\libraries\Adafruit_LED_Backpack_Library/Adafruit_LEDBackpack.h:147:8: note: no known conversion for argument 1 from 'DeviceAddress {aka unsigned char [8]}' to 'long unsigned int'

exit status 1
call of overloaded 'println(DeviceAddress)' is ambiguous

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 22, 2016 9:51 pm

apparently i have more than 1 error i didnt scroll up im so sorry

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Fri Jan 22, 2016 10:04 pm

You have insideThermometer defined as a device address:

Code: Select all | TOGGLE FULL SIZE
// arrays to hold device address
DeviceAddress insideThermometer;


And you are tying to print it here:
Code: Select all | TOGGLE FULL SIZE
  // print with print/println
    {
    matrix.println(insideThermometer);
    matrix.writeDisplay();
    delay(10);
  }


I think you really want to print the temperature, not the device address. That is what your printTemperature() function does.

Code: Select all | TOGGLE FULL SIZE
// function to print the temperature for a device
void printTemperature(DeviceAddress deviceAddress)
{
  // method 1 - slower
  //Serial.print("Temp C: ");
  //Serial.print(sensors.getTempC(deviceAddress));
  //Serial.print(" Temp F: ");
  //Serial.print(sensors.getTempF(deviceAddress)); // Makes a second call to getTempC and then converts to Fahrenheit

  // method 2 - faster
  float tempC = sensors.getTempC(deviceAddress);
  Serial.print("Temp C: ");
  Serial.print(tempC);
  Serial.print(" Temp F: ");
  Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
}

adafruit_support_bill
 
Posts: 74951
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 22, 2016 10:19 pm

Correct I'm trying to print the temperature. I thought I could just use matrix.println(tempC); but that returns a error as well maybe I thought that tempC was a array or string stored form the process of getting the temp and I could just print the result but that does not work.. I guess I'm back to reading more.


what im shooting for is this output..

Serial.println(DallasTemperature::toFahrenheit(tempC)); // Converts tempC to Fahrenheit
except i want to display it to the 7seg not the monitor

I want to display it to the 7seg.. when i use it on my matrix.printIn i just get tempC is not declared in scope

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 22, 2016 11:12 pm

Please ignore the last 2 posts.. I am a idiot.. lol well not really but i worked with it and changed it now I can atleast get it to display the temp on the display on restart i just need to get it to update. :)

Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Sat Jan 23, 2016 6:58 am

I want to display it to the 7seg.. when i use it on my matrix.printIn i just get tempC is not declared in scope

That is correct. It is declared in printTemperature(), not in your loop. If you want to use tempC, in your loop you need to declare it and assign to it just like you do in printTemperature().

Code: Select all | TOGGLE FULL SIZE
float tempC = sensors.getTempC(deviceAddress);

adafruit_support_bill
 
Posts: 74951
Joined: Sat Feb 07, 2009 10:11 am

Re: Newb.. With Question on what to use.

by Blue_Ice on Fri Jan 29, 2016 5:29 pm

Thanks for the help I have it working now and its great. I have another question tho. I am outputting to a 7seg display and want to write a " F" in the far left digit of a 4 digit display and then have the temp display on the other 3 digits. here is the code for displaying the temp to the matrix im a bit lost on how i can write the "F" on it.


can anyone help?

Code: Select all | TOGGLE FULL SIZE
   TEMP_Update( );
    matrix.println( valTemp, DEC );
    matrix.writeDisplay();
    delay(30000);


Blue_Ice
 
Posts: 33
Joined: Wed Dec 30, 2015 3:12 pm

Re: Newb.. With Question on what to use.

by adafruit_support_bill on Fri Jan 29, 2016 6:07 pm

Code: Select all | TOGGLE FULL SIZE
  // print a hex number
  matrix.print(0xF, HEX);
  matrix.writeDisplay();

adafruit_support_bill
 
Posts: 74951
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.