Wikipedia says that a proportional–integral–derivative controller (PID controller) is a generic control loop feedback mechanism (controller) widely used in industrial control systems – a PID is the most commonly used feedback controller. A PID controller calculates an “error” value as the difference between a measured process variable and a desired setpoint. The controller attempts to minimize the error by adjusting the process control inputs.
I wanted a way to have a “rotatable” counter to indicate that the LCC was still looping properly. I finally found something! A decade counter (as noted in an earlier post)!
Now instead of pulsing one led I have a “spinner” type of effect. I don’t have to keep track of where the “count” is….I just pulse it. Coding this would have been a nightmare. Of course wiring 10 LEDs is a mess but it’s a cool one.
I haven’t worked on the Tri-Temp project in a while. I am going to go through and update the code a bit to lower the memory usage based on what I’ve learned for the LCC projects.
The original LCC code will have an update posted soon too. Mostly memory updates and a few control changes. I wasn’t sure if I wanted to bother but since the original LCC is still running my lizard’s climate I figured why not.
I’ve been programming for most of my life. Very very rarely have I had issues with memory or lack of memory.
Now that I’m hot an heavy into microcontroller programming I’ve stumbled across an issue that has apparently been causing me issues without me know it it.
Lack of memory!
The ATmega328 series chip that is the brain of the typical Arduino board has 3 memory locations.
The Flash is typically 32k bytes. This is what the Arduino IDE tells you about when you compile/upload your code.
The SRAM is something no one told me about…this is the actual operating program memory space (RAM). This is where your app runs and lives. Your variables live here. When this space is used up things get wonky. The Arduino crashes or worse does strange unexplainable things.
The EEPROM is generally not used by the average programmer so I won’t cover it here.
After all this learning I finally got my code “optimized”. I thought my latest project was a gonner but putting variables in Flash, dumping A LOT of debug code made a huge difference. I went from zero bytes of RAM and crashes to about 646 bytes free. Doesn’t sound like much but when you only have 2048 bytes to start with, that’s pretty good!
Now to figure out how to have my debug code and still keep the memory usage low!
I’ve started on LCC 2nd Gen or LCC2 or LCC II. I don’t know what to call it. BUT I do know it’ll be killer.
This one is going to be everything LCC 1 was not.
So far I have:
A better RTC
2 OLED displays
The RTC can be updated via serial — no need to upload code to the Arduino, update the clock and then reupload the LCC code!
More cool factor….
So check this out- I2C rocks! The awesome Centipede Shield from macetech.com is HUGELY awesome. Via the I2C 2 wire interface you now have access to 64 Digital ports. In any combination of In or Out. This is the cornerstone of the new LCC hardware. Especially since the Ethernet takes a lot of digital ports. This thing is way cool. If you need more digital ports get one asap.
The OLED displays are really neat. I got 5 from a Kickstarter project and they’re now generally available from Sabernetics Tech. They’re tiny and bright! Since you now have 64 ports you can have as many of these displays as you want. Just put each on its own port to select which one to write to…If you don’t you’ll write to them all at once! Gotta love bus networks (I2C).
I hope to make the LCC’s ability to control lights and heat sources more generic. Since the IO is so plentiful I can make the code generic enough to handle fans, heat mats, uv lights etc in different combinations.
Keep checking the site as I post updates about this project!