Teensy 3.1 Voltage sensing and low battery alert

Status
Not open for further replies.
The cards show T_LC, T_3.0 and T_3.1 with Vin range of (3.7 to 5.5 volts). New regulator on T_3.2 shows Vin (3.6 to 6.0 volts).

Not sure if any damage happens with under voltage - but at some point it will fail to function as designed.
 
Is it possible to do something similar with teensy 3.5? Is there something similar to the analogRead(39) (since 39 is an actual pin on teensy 3.5 )?
 
Yes, use 71 for T3.5 and T3.6. teensy really needs symbolic names for those internal ADC channels.
Code:
void setup() {
  analogReference(DEFAULT);
  analogReadResolution(12);
  analogReadAveraging(32);
} 

void loop() {
  int mv;
  mv = 1195 * 4096 /analogRead(71);
  Serial.println(mv); 
  delay(2000);
}
 
Thanks manitou!! I'm gonna test it now. Can I also ask where do you get the information from? (e.g. is there a specific page on a datasheet ?)
 
where I first heard about it was on the T3.6 beta thread.

But how I then verified it and fixed it in some cases was to look at the code.
That is if you look in your Teensy install: .....\hardware\teensy\avr\cores\teensy3
at the file: analog.c at about line 396 is the table for the T3.5/T3.6, that converts the number passed into analogRead
into the appropriate settings for the analog system and you will see in the comments 70 is temp and 71 is vreef...

Again hopefully this will make it into WIKI and I agree with manitou that we should create some defines for these.
 
Action on low voltage detect?

I'm doing an eye candy project for a small bluetooth speaker, using a 24 neopixel ring. The neopixels draw way more current than the Teensy, Would like to, on detection of a battery brownout, to call a function that turns off the neopixels then turns off the teensy. This function will be named Suicide(). Possible?
 
I'm doing an eye candy project for a small bluetooth speaker, using a 24 neopixel ring. The neopixels draw way more current than the Teensy, Would like to, on detection of a battery brownout, to call a function that turns off the neopixels then turns off the teensy. This function will be named Suicide(). Possible?

Yes - I have done this for running Servos on a robot. I sense the battery voltage (usually one of two ways). Some of the Servos sense voltage and you can ask them for their voltage, which then I may alternate around asking different servos (as well as their temp..) or I use simple resistor divider to an analog pin (assuming the battery voltage > 3.3v), and when it gets too low, I change the state of some IO pin. Connected to that IO pin is a transistor (or two), which are sized to handle the load, to turn off the voltage to the servos or in your case
Neopixels.
 
Yes, use 71 for T3.5 and T3.6. teensy really needs symbolic names for those internal ADC channels.
Code:
void setup() {
  analogReference(DEFAULT);
  analogReadResolution(12);
  analogReadAveraging(32);
} 

void loop() {
  int mv;
  mv = 1195 * 4096 /analogRead(71);
  Serial.println(mv); 
  delay(2000);
}

What's the pin for T4?
 
Status
Not open for further replies.
Back
Top