Coming Soon: Teensy-LC (low cost Teensy)

Status
Not open for further replies.
wow, thanks for the fast answer. Can I make it compatible, or is this an absolutely no :)

The Teensy 3.x chips use an Arm Cortex M4 chip, while the Teensy LC uses an Arm Cortex M0 chip. Among other things that the M4 has that the M0 does not have is a bunch of integer vector instructions where it does the operation on an integer sized value (32-bits) which are really parallel 8/16-bit fields. The audio libraries use these instructions to speed up the processing of the audio files. In addition, the M4 normally runs at a higher clock speed.

So, you may be able to do it, but it may involve adding #ifdef's to the code for LC support, and possibly not doing as much due to the slower processor.
 
Well most of the audio library uses advanced math not available on LC - this will probably never be implemented.

its possible to make parts of it work, I'm sure. It's unlikely to play Franks MP3 and AAC bits, but playback of WAV and RAW with some mixing and possibly some synth functions is quite possible. The power is there to achieve the basics.

I know Paul plans to do this to some extent - and has made some progress however small. But that's all I know.

if you like a challenge then go for it!
 
Sure, jump right in. Fork the code on github and start hacking. I've already done some work towards Teensy LC support, but much remains to be done....

The place to work first is output_analog.cpp. The entire library depends on at least one input or output object having update responsibility. You'll see some preliminary work has already started, but it's incomplete and utterly untested and certainly doesn't work yet.

I can't do a lot of guide your effort, but hopefully this can at least help you get a start in the right place.
 
Understanding. I thought it would be nice to get it for the half price (LC). And the only thing I need was to use it as sample player... so the whole audio Effects / FFT code is not necessary.

I think not a huge task. But... anyway, I've an other (smarter an smaller) solution for this issue, without the teensy audio board.
 
No, there's no internal reference voltage on Teensy LC. Your only options are 3.3V power, or applying an external reference voltage.

The internal 1.2V references is unfortunately one of the features removed that allows the hardware to be so much less expensive.
 
EEPROM: 128 Bytes are to small. I need min. 256 or better 512 . It's emulated, so it would be nice to update the EEPROM size for the Teensy LC and take another 1-2K from the flash size.
 
EEPROM: 128 Bytes are to small. I need min. 256 or better 512 .

You can get 255 by editing E2END in eeprom.h

https://github.com/PaulStoffregen/cores/blob/master/teensy3/avr/eeprom.h

255 (#define E2END 0xFE) is the maximum, since 8 bits are used for the address and 0xFF is reserved for unallocated space.

Increasing to 255 will consume more RAM on the stack when you fill up the flash and all 255 bytes need to be temporarily held on the stack while the flash is erased.

You'll also get less wear leveling, since the same 2K flash (supporting 1024 writes) will be used.

It's emulated, so it would be nice to update the EEPROM size for the Teensy LC and take another 1-2K from the flash size.

A huge change that breaks backwards compatibility with every Teensy LC already shipped just isn't going to happen.

If you need more memory, use Teensy 3.2 or an external EEPROM chip.
 
I'm going to be using one of these for an automotive gauge project. I see in the specs it has a 5V output on pin 17? Is it possible to use this to power a NTC thermistor that is designed to work on 5V? I have tested it OK on 3.3V, but saw tonight the LC has a 5V output so I wanted to ask about this.
 
Depends on what you mean there. The 5V output is actual a Vin output so for powering a thermister it is the same as connecting it to the Vin pad, unless being able to depower it is a critical thing which this would allow. Would be cautious of what sort of analog stability you would get from this as well.
 
According to my notes, the VIN output on pin 17 can deliver 8mA. Note, the LC is NOT 5v compatible for digital inputs. If you read from the thermistor and it returns more than 3.3v, you risk damaging the Teensy LC. The pin on the Teensy LC is meant to drive ws2812b (neopixel) LED strings where pin 17 is the data stream, but the main power for the LEDs comes from VIN (typically 5v when you are using USB).
 
Thanks for the answers. Would it be feasible to power the thermistor from the 5V input power (I'm using a hacked USB phone charger to step down 12V to 5V) and then read it on an analog pin? Do you think there would be any long term issues on powering it via 3.3V? I adjusted a resistor setting in the code and it gave a reliable reading. The datasheet says the coolant temp sensor is designed to operate on a "typical voltage supply" of 5V. Again, I appreciate the advice and education here.

Datasheet


Here's my project thread if you need it.


EDIT
I took some voltage readings at the sensor pigtail at 84 degrees ambient:
Using 3.3V: 1.575V

Using 5V: 2.375

Continuing with 5V, I then used a hairdryer to heat the sensor.
129 degrees F: 1.175V Voltage continued to decline as temperature increased. The sensor has a range of up to 302 degrees F.

I then used a cup of ice water to cool the sensor:
41 degrees F: 3.619V

It looks like it would indeed go beyond 3.3V in colder weather at least until the oil warmed up.
 
Last edited:
Given it works from 3.3V it looks like there isn't anything particularly clever in it's internal design so would suggest sticking with 3.3V power and calling it done. If it had active components in there then it would be more likely you'd find min and max supply voltages but given it's >100 degrees operating enviroment there are probably no silicon components inside there, just some carefully crafted passives that as long as you don't run so much current through it that things melt will pretty much not care what's running through it. Would be nice if the data sheet was a bit clearer on the topic though.

If you wanted to do this right you run the sensor off 5V, and use an op-amp to shift it's offset and range to match the Teensy. This takes you into instrumentation amplification which is a useful design skill but probably more than you want to deal with on this particular project.

https://en.wikipedia.org/wiki/Operational_amplifier

Idea would be to set up one or possibly two amplfiers so you get the full analog range of the Teensy for the useful temperature range, and clamp things so you don't exceed the Teensy input tolerences (op amps normally have more robust inputs) while also probably doing some common mode noise suppression. As stated before this would generally be overkill for a temp sensor on an engine, but could be an interesting learning project if that's the plan.
 
Being a noob on this stuff, I found out my resistor value in the code for 3.3V was way off, my 41 degree ice water read 93 degrees, so I need to either adjust something or go with another sensor to use 3.3V.

Here's the relevant code, which was accurate for both hot and cold ranges at 5V:
Code:
// Data for thermistor
int a;
float temperature;
int B=3975; //B value of the thermistor
float resistance;

I had changed the 3975 to get an accurate reading on 3.3V at room temp.

Then in the loop section:
Code:
a=analogRead(0);
 resistance=(float)(1023-a)*10000/a;
   //get the resistance of the sensor
 Temp=1/(log(resistance/10000)/B+1/298.15)-273.15;
   //convert to temperature via datasheet
 Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celsius to Fahrenheit

The GM sensor I'm using needed a 2.2K + a 550 ohm resistor to give an accurate reading using 5V. I had arrived at that after using a spreadsheet with the table data from the datasheet. I can't understand the voltage input factor at this point, so I'm doing more reading.

If I'm using 3.3V, I'm presuming I need to change these. What formula to calculate this should I use?

As an alternative, I considered a digital sensor. I found this one (LMT01LPGM) at Mouser for under $3, it's a TI digital sensor that has an operating range of 5.5 to 2V:
Datasheet

Depending on the diameter, I could enclose it in a brass pipe fitting and add a pigtail to it.
 
I did some experimenting with the resistors on the sensor, and by changing the 2.2K + 550 to 10K + 550 I was within .2 degrees between the two sensors at room temp.

I then immersed the sensor in another cup of ice water. After a few minutes, it dropped to 55 degrees where it had been 41 earlier. Substituting a 10K resistor lowered the reading to 54 degrees.

Next I retried the pan of boiling water. Where the sensor at 5V had been fairly dead on at 199 degrees (200 indicated on manual thermometer), after several minutes the sensor read only 103 degrees.

To verify my findings, I tried again @ 5V with the original 2750 ohm resistor. It immediately display 188 degrees, which by the time elapsed (the water had cooled) was consistent with the thermometer.

It seemed like it was very slow to respond to temperature changes as well. The sketch calls for a B value, which was 3975 for the 5V setup. I don't know enough to determine if the B value should change along with the sensor's resistors.

My conclusion at this point is that this sensor does not do very well with 3.3V. Absent another solution, I do not consider it usable here at 3.3V.
 
Given it works from 3.3V it looks like there isn't anything particularly clever in it's internal design so would suggest sticking with 3.3V power and calling it done. If it had active components in there then it would be more likely you'd find min and max supply voltages but given it's >100 degrees operating environment there are probably no silicon components inside there, just some carefully crafted passives that as long as you don't run so much current through it that things melt will pretty much not care what's running through it. Would be nice if the data sheet was a bit clearer on the topic though.

If you wanted to do this right you run the sensor off 5V, and use an op-amp to shift it's offset and range to match the Teensy. This takes you into instrumentation amplification which is a useful design skill but probably more than you want to deal with on this particular project.

https://en.wikipedia.org/wiki/Operational_amplifier

Idea would be to set up one or possibly two amplifiers so you get the full analog range of the Teensy for the useful temperature range, and clamp things so you don't exceed the Teensy input tolerances (op amps normally have more robust inputs) while also probably doing some common mode noise suppression. As stated before this would generally be overkill for a temp sensor on an engine, but could be an interesting learning project if that's the plan.

Thank you for your help and suggestions. I need to learn about op amplifiers.

It seems like the best solution with what is mostly on hand is to craft a 3.3V capable sensor such as the one I linked above. I'd like to keep this project less complex electronics wise so that if another noob comes along they can easily repeat what I've done. I did some tinkering this afternoon with an old 1/8 NPT water temperature sender. I cut off the terminal and gutted the inside with a drill bit. Plenty of room for the above digital sensor (it is 4.1mm wide). It could be held in place inside the tube via some silicone and topped off with JB Weld. The next problem would be adapting that to a 3/8 NPT opening which is what is on the car. I looked at a 3/8 NPT plug and I think I can turn down the hex on the 1/8 unit and then solder the two together. The bit that sticks out would be sufficient to expose the sensor inside. I made something similar for a motorcycle Microsquirt project a while back. I also have a number of feet of some shielded 22 gauge wire on hand from another project that could be put to use here.

If this works out I'll likely make two gauge sets so I can use the second one to replace two existing gauges in another car.
 
Last edited:
Thanks for the links. I've been reading datasheets today and going through some brass pipe fittings I have on hand. I was able to cut the end off of an old 1/8 brass NPT temperature fitting and drill it out. An 18B20 sensor fits inside it easily, but it cannot handle a high enough temperature range. I turned down the hex part of it and it will fit tightly into a 1/4 brass pipe plug. I ground down the end and it is now the same length past the thread as the GM sensor. The plug end can be opened up so the sensor could go in after the tube was soldered and then sealed as below.

The sensor I'm leaning toward now is the TI LM84T (data sheet link). It's under $1 at Mouser, runs on 1.5 to 5.5V, is good to 150 C, and is 4.3 x 3.5mm. Using my design program it will fit into a 6.1mm ID / 7mm OD tube- it would almost fit into a 5.1mm ID / 6mm OD tube. McMaster-Carr sells inexpensive metric and SAE brass tubes as well as brass rods that can be used to cap them via soldering.

At this point, I'm leaning towards making my own sensor housing with the LM84T inside. It looks like the 6mm OD/5.1mm ID tube could be enlarged slightly to clear the sensor or I could use the next size up. Having a tight fit at the end would be a good thing for heat transfer. I could then insulate the leads with some 22 gauge TXL wire casing and some silicone sealant. The sensor could then be capped off with some JB Weld for a permanent install.

I read about people wanting to interface sensors with the Arduino for vehicle use, and if this works as planned it could help them in the future.
 
Now that I have a viable sensor housing, I've been trying to learn about converting millivolts (mV) to degrees Celsius (C) for use with the LC, but have experienced severe brain fade. ;) Time to ask the experts.

The LMT84 datasheet specifies a lookup table, which was a spreadsheet in a zip file. I downloaded it and learned:

The LMT84 sensor outputs in mV with a range of 1299 to 183.
1299 is -50 C and 183 is 150C.

Here is some math I performed:
The Teensy LC has a resolution of 12 bits and an analog voltage input range of 0-3.3V.
12 bits= 4,096 resolution compared to the usual 10 bit 1024.
3.3V / 4096= 0.0008056641 V resolution, or 0.8056640625 mV.

1299-183= a mV range of 1116
1116/4096= .2725 mV/degree

Since this is smaller than the .8056x above, does this mean the LC does not have the resolution to read this sensor in mV?

I'd prefer to avoid putting a lookup table into code, so I've been reading about formulas. It appears most of them are for increasing temperatures and increasing voltages.

As the LMT84 temperature increases, the voltage decreases.

I tried a few formulas I found and experienced the above brain fade. I have a lot of data, but don't know how to apply it.
 
An LC can measure the temperature: you need to decide how much accuracy you need.
The output range of the LMT84 is 1.116 volts, which is (1.116/3.3)*(2^12) = 1385 counts of the ADC's range. Each degree would be 1385/(150 + 50) = about 7 counts.


The datasheet notes (in section 8.3.1 )that there is a parabolic shape to the volts/degree equation and offers some approximation equations.
 
Thanks for the help. I went to math class with Barbie :), so I'm trying to work the equation listed. I came up with a negative number to square, which is impossible, so I've done something wrong.
 
Status
Not open for further replies.
Back
Top