PID Hardware Photos

I was (and hope to again) working on a PID loop for the dragon’s main light. The idea is simple- vary the heat lamp using a servo and rheostat. Some of you have expressed interest. Here are the photos of the servo setup. The code however is so bad I don’t even know where to start. If you get something working please let me know!

The servo and linkages work perfectly through the full 180 degree range. The issue is the PID code….

Continue reading “PID Hardware Photos”

Just no time!

I hope to get to play with my arduino projects over the next week when I’m off for the holidays.

The first hardware version of Lizard Climate Control project is still faithfully running with no glitches. The only adjustments I ever make are to the RTC which can’t keep time to save its life.

The next LCC hardware version will include a more accurate, temperature compensated RTC so I shouldn’t have to mess with it. However when I last played with the code for it I ran out of RAM and program storage space on Arduino. Thus I will most likely be using an Arduino Mega for the next version.

Happy Holidays!

Microcontrollers, Embedded Systems and Single Board Computers

Many different terms are used for the devices that run our small computing projects. In addition there are lots of different hardware/software platforms. Many are pin compatible, similar in size and function and can achieve the same result in different ways.

Here are some of the common terms:

Microcontroller
A microcontroller is a small computer built into a single chip. This chip contains the processor, RAM, EPROM and I/O pins. These generally are designed for executing I/O and small computational functions.

The Arduino is not just a microcontroller. It’s a platform that includes a microcontroller. Usually an ATMega chip. An Arduino also includes other chips and components to make it easy to communicate with, program and prototype with.

Embedded Systems
Embedded systems are also small computers all on one chip (also called SoC for System On a Chip). These are generally more powerful (32 bit as opposed to 8 or 16 bit CPUs on microcontrollers) than a microcontroller and can run full operating systems like Linux or Windows. They too have other chips for communication and I/O and offer programming in higher level languages supported by the operating system. The Raspberry Pi is considered an embedded system but also falls under the next classification. Embedded Systems are also found in many consumer electronics like MP3 players and cell phones. In these cases they aren’t for prototyping or user programming but their features are very similar. iPhone and Android phones/tablets also use SoCs extensively.

Single Board Computer
A single board computer is an Embedded System with ALL the bells and whistles on a small board. This usually includes USB, Ethernet, Video, GPIO, Storage and possibly expandable memory. The Raspberry Pi is definitely a single board computer. It also has prototyping components like most microcontroller platforms. It’s a powerful fully featured system.

 

Lost Memory…

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.

JeeLabs has a killer write up on the SRAM and…wait for it….how to see how much is used!

I added their little function to output RAM usage and holy cow. I had it all used up!

So I had to learn about memory management. Lesson one- strings use up a lot of space!

JeeLabs also has a killer write up on how to optimize your string usage. READ IT! The Arduino site also has a write up on how to use the Flash memory for storing static variables too.

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!

 

The Next Lizard Climate Control…

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:

  • Ethernet
  • 64 GPIOs
  • 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!

Random Thoughts and Thanks.

I’ve always loved electronics. Sadly I started before the internet. Now, in just a few minutes I’ve found some of the coolest projects for Arduino and other micro controllers. And the author (lucky larry) of this project is over seas from me. How cool is that? What a great and under appreciated resource the internet is!

Remember back when you had to wait for a magazine to show up with ideas? The library certainly didn’t have do it yourself books. Or worse you had to find someone who knew more than you?

I guess I just want to thank EVERYONE in the Maker movement for sharing. Visit my site Arduino Everything for my projects!