circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

Issue 93 April 1998
Picaro: A Stamp-like Interpreted Controller


by Tom Napier

For years, Tom’s been itching to control the instruction sets of processors. Using a PIC, some memory, and an interpreter, he bypasses the processor hurdle and writes his own language. He shows you how to do it, too.


The core technique at work in the PLU is to take the record for the same day of the previous week and use it to predict the occupancy for the current day. It’s well worth keeping a week’s worth of records since human habits center around a weekly pattern.

The process of putting the data to work is straightforward. Once every hour, at the same moment when the current occupancy state is recorded in today’s record, the record for that same day in the previous week is evaluated.

At this moment of truth, the algorithm looks ahead in the record to see if there is any expected occupancy. It only needs to see a couple of bits in the data from the previous week—the ones that indicated the occupancy state in the next 2-h slots.

These bits tell us if the area was occupied a week earlier during the upcoming couple hours. If so, then it’s likely to happen again. If the system senses an unoccupied state, then it need only check for either of the upcoming two hours to indicate an expected occupancy, and voilą—we have anticipation.

Note that, using this method, there is a resolution of 1 h, which means that accuracy is ± 1 h. That’s why the anticipator looks at the next 2 h of last week’s record. If it only looks 1 h ahead, it could err on the minus side all the way down to (almost) zero anticipation. Using 2 h gives it a performance range of 1–3 h of anticipation.

The range could easily be decreased by using a higher resolution system-wide. For example, records could indicate half-hour increments instead, which double the RAM usage but be otherwise identical in function, yielding an anticipation range from 30 to 90 min. The beauty of this method is that any resolution can be used and the implementation remains pretty much the same.