[Back to Home Page]

www.RomanBlack.com

Shift1-LCD projects
Things you can make with a Shift1-LCD kit! - 3rd Nov 2009.





Click HERE to see my Shift1-LCD "how it works" page


About these projects

The Shift1-LCD is a low-cost kit I designed that lets you use 1 PIC pin to control an entire LCD and backlight.
It also has an option of using an on-board 8pin PIC 12F675 to make a complete device, all smaller than the LCD itself!

These following projects are open-source, you can use them as you like but please mention me and my Shift1-LCD system if you use my source code. The Shift1-LCD kit is Available here!

Wherever possible the following projects are complete, ie all you need is a Shift1-LCD kit, an LCD, and a few external parts to make a complete device. I have included all source code and hex files where possible.




+5v regulator option




The Shift1 PCB has an un-connected pin marked V, it is the first pin on the 10 pin header.

This can be used for easy mounting of a standard 7805 +5v regulator. The regulator is soldered on the bottom of the PCB and connects to the first 3 pins;
  • V (Vin)
  • Gnd
  • +5v




    SH1_Clock   3rd Nov 2009

    Requires Shift1-LCD with PIC 12F675 option and 8MHz xtal - 1x8 or 1x16 LCD





    This is a simple 12-hour clock (like an alarm clock). It just displays the time on the LCD.

    There is ONE button to set the clock on pin GP1 (LO = pressed);
  • hold button - changes hours
  • quick-press button - changes minutes (and reset seconds)

    Note1 I only used one button for clock setting as that allows 2 spare PIC pins to use for in/outs. ie you can add inputs to start/stop a timer, or outputs to turn stuff on/off by the clock.

    Note2 The system to generate each second is my zero-error 1-second timer system that uses a long constant (8000000) to represent the 8MHz xtal. This long constant can be adjusted to give very fine control of time to "trim" the clock to be very accurate.

    The source code is very simple and can easily be adapted to make event timers, countdown timers, time controllers etc. It only needs a single-line LCD but will work fine on a dual line LCD too.

    Source code in MikroC, also HEX file etc; SH1_Clock.zip 14 kb




    SH1_Servo   3rd Nov 2009

    Requires Shift1-LCD with PIC 12F675 option and 8MHz xtal - 1x16 LCD





    This is a tester for RC Servos It has a pot, when the pot is turned the Servo turns the same. There are 2 ranges to give Servo pulse width of 1000uS-2000uS or 500uS-2500uS. The pulse width is displayed on the LCD as actual microseconds, which is handy for setting up RC Servos.

  • GP0 - pot wiper (ADC input), the pot controls servo
  • GP1 - digital output, servo pulse out
  • GP3 - "range" button, low = pressed (needs 10k pullup resistor!)

    Note! Add a 100uF cap from GP0 to ground. This reduces noise picked up by the ADC and gives smoother servo operation.

    Source code in MikroC, also HEX file etc; SH1_Servo.zip 16 kb




    SH1_Charge   3rd Nov 2009

    Requires Shift1-LCD with PIC 12F675 option (no xtal) - 2x16 LCD





    This is a battery charge controller for use in solar or wind power installations. It measures the battery voltage and displays it. It also has an adjustable SetPoint, when the battery voltage is over the setpoint it turns the "load" on, ie sets a PIC pin high, and displays "LOAD" on the LCD. This automatically controls the battery charge so the battery cannot be overcharged and damaged.

    This project is quite sophisticated, the Setpoint voltage you select is stored on the PIC internal eeprom so it is there on any power up. Also there are 4 battery voltage ranges, enough choices to suit all battery systems (6v 12v 24v 36v 48v). The battery range is also stored in eeprom.

    Adjustment is done very simply by 2 buttons. These adjust the SetPoint UP and DOWN, first in 0.02v steps then in 0.1v steps. If both buttons are pressed at the same time, the VOLTAGE RANGE changes.

    Input of battery voltage is via an external pot (10k or 50k) connected to GP0. This "trims" the battery voltage to display correctly. There should also be a large cap from GP0 to ground, about 220uF or 470uF. This smoothes any spikes etc on the battery voltage caused by other equipment.

    Output is from 2 PIC pins, GP4 and GP5. These are opposite to each other, so you can use them as high-side or low-side drivers etc, usually to turn a relay ON or OFF as needed. This makes it easy to use the device to turn something ON when battery is too full, or turn something OFF when battery is too full, or both.

  • GP0 - pot wiper (ADC input), a 5k or 10k pot controls servo
  • GP1 - button - adjust SetPoint UP (lo = pressed)
  • GP3 - button - adjust SetPoint DOWN (lo = pressed)(needs 10k pullup resistor!)
  • (GP1+GP3 - both pressed - changes voltage display Range)
  • GP4 - out - control load
  • GP5 - out - control load (inverted)

    Note! Once the battery voltage reaches the setpoint and the LOAD turns ON, it will remain on for a minimum of 10 seconds duration. That is a safety feature for situations where the load might be a water pump etc, it will always run for at least 10 seconds.

    Source code in MikroC, also HEX file etc; SH1_Charge.zip 20 kb




    SH1_Tacho   4th Nov 2009

    Requires Shift1-LCD with PIC 12F675 option and 8MHz xtal - 1x16 LCD





    This tacho measures the RPM of machinery like lathes and drill presses, engines etc.

    It measures RPM based on period (xtal locked) over 4 pulses to give an accurate RPM measurement. It has another RPM display (shown on the right) which is an average of the 4 previous RPM measurements (an average of 16 pulses). The average RPM is a useful display to show real time RPM of machinery where the speed is constantly fluctuating slightly due to cutting or drilling cycles etc.

    The tacho has 4 ranges, these select how many pulses per rev (which is based on the machine rotor). The choices are 1, 2, 4, 8 pulses per rev. For slow turning machinery (lathes, drill presses) an 8 pulse per rev rotor is best because it gives a lower RPM measuring ability. For faster machinery (grinders, high speed PCB drills) then 1 pulse per rev rotor is best because it will give finer measurement but not be able to measure very low speeds. As an example; if your machine will not be operated below 240 RPM then you are best with the 1 pulse per rev rotor.

    The 4 rotor types are set by PIC pins GP1 and GP0;
  • GP1=1 GP0=1 = 1 pulse per rev; max RPM = 65000, min RPM = 240
  • GP1=1 GP0=0 = 2 pulse per rev; max RPM = 65000, min RPM = 120
  • GP1=0 GP0=1 = 4 pulse per rev; max RPM = 65000, min RPM = 60
  • GP1=0 GP0=0 = 8 pulse per rev; max RPM = 65000, min RPM = 30

    The signal pulse from the rotor must be digital level (0v-5v) and connected to PIC pin GP3.

    Note! Because the measurement is done by period (for accuracy) the display updating time is based on machine speed. At very low RPMs the display will update every 2-3 seconds. At higher RPMs the display will update much faster, like a few times a second.

    Source code in MikroC, also HEX file etc; SH1_Tacho.zip 17 kb




    SH1_Temp   5th Nov 2009

    Requires Shift1-LCD with PIC 12F675 option (no xtal) - 2x16 LCD





    This is a temperature controller using a LM335 temp sensor that can be used to control incubators, drying ovens, refrigerators, freezers etc.

    The LM335 sensor is a cheap and common temperature sensor that will read from -40'C to +100'C. It's output is calibrated in degrees Kelvin so this project converts that to degrees Celcius. The LCD shows the measured temperature in 'C on the top line, and the temperature Setpoint on the bottom line. Also on the bottom line (left) the display shows HEAT or COOL depending on what the device is doing.

    Adjustment is done very simply by 2 buttons. These adjust the SetPoint UP and DOWN, first in 0.5'C steps then in 2.5'C steps. The setpoint adjustment is stored in PIC eeprom so it will remain, even after a power cut etc.

    The temperature sensor is connected with its + pin to PIC pin GP0. The sensor - pin is connected to Ground and its Adj pin is not connected. You will probably need a capacitor from GP0 to Ground (try 47uF) connected at the PCB terminals (not on the sensor itself). The cap will reduce noise that causes jittery readings.

    LM335 temp sensor datasheet here. 877 kb

    Output is from 2 PIC pins, GP4 and GP5. These are opposite to each other, so you can use them as high-side or low-side drivers etc. Generally the PIC pin GP4 would control a logic-level relay (or turn on a transistor to operate a relay), and that relay would control the heater.

  • GP0 - (ADC input), connects to LM335 + pin (also put a cap here)
  • GP1 - button - adjust SetPoint UP (lo = pressed)
  • GP3 - button - adjust SetPoint DOWN (lo = pressed)(needs 10k pullup resistor!)
  • GP4 - out - control heat
  • GP5 - out - control heat (inverted)

    Source code in MikroC, also HEX file etc; SH1_Temp.zip 19 kb




    SH1_Temp_2   14th Nov 2009




    NEW! A complete drying-oven controller for paint curing!





    SH1_Counter   29th Nov - Web 16th Dec 2009

    Requires Shift1-LCD with PIC 12F675 option (no xtal) - 1x16 or 2x16 LCD





    This is a counter, actually it is 2 independent counters. Each counter has 16 digits so they can count REALLY big numbers, each 16 digit counter will count up to 10 thousand trillion!

    If the PIC pin GP5 is held LOW it only uses one counter, this feature lets you use a 1x16 LCD and just use a single counter. Otherwise there is a separate 16 digit counter on each line of the 2x16 LCD.

    PIC pins;
  • GP0 - counter 1 signal in, inc counter1 on \ edge
  • GP1 - counter 2 signal in, inc counter1 on \ edge
  • GP3 - low = reset counter 1 (needs 10k pullup resistor)
  • GP4 - low = reset counter 2
  • GP5 - low = 1 counter, hi (default) = 2 counters

    The 2 counter inputs are debounced in software, so they must be pulled low for >7mS to make a count. This debounce has been tuned to work with most mechanical switches, pushbuttons, microswitches, magnetic reed switches etc if the counter is to be used on a machine. The debounce gives a decent immunity to contact bounce which would cause extra counts!

    Maximum count rate is about 5 counts per second if clocking both counters at the same time, otherwise is about 10 counts per second if using just one counter (or if just clocking one counter).

    The software is very simple and uses my own nifty system for making an unlimited-digits counter by storing the count only as text, so the little PIC still only needs to work with single byte variables (no longs, doubles etc). My counter routine is fast executing and can have unlimited digits (limited only by the length of the text character string), and it also supports leading blanks;
    
    //=============================================================================
    //   INC COUNTER
    //=============================================================================
    void inc_counter(unsigned char *icount)
    {
      //-----------------------------------------------------
      // the counter values are stored as text.
      // so inc them using a special procedure starting
      // at the final (right) character then working back.
      //-----------------------------------------------------
      // loop and inc the counter
      i = 15;
      while(i < 16)
      {
        if(icount[i] < '0') icount[i] = '0'; // change digit to '0' before inc it
        icount[i]++;                         // inc the digit
    
        if(icount[i] <= '9') break;          // if no digit roll, inc is done
        icount[i] = '0';                     // digit roll, so clr it, and inc next
        i--;
      }
      // check for final roll and do a counter reset, to put blanks back in
      if(icount[0] == '0') clear_counter(icount);
    }
    //-----------------------------------------------------------------------------
    
    

    Source code in MikroC, also HEX file etc; SH1_Counter.zip 14 kb




    SH1_Morse   29th Nov - Web 16th Dec 2009

    Requires Shift1-LCD with PIC 12F675 option (no xtal) - 2x16 LCD





    This is a Morse code trainer that plays the Morse code as standard timed beeps through the speaker and also displays it as text on the LCD.

    It is reasonably sophisticated, as least as far as the 1k ROM limit on the PIC 12F675 will allow. The Morse characters use proper timing and the WPM can be selected by the user from 5 to 35 WPM in 31 separate adjustments. WPM is official and based on the Paris standard. The intra-character and character and word spacing are all standard. Output audio frequency is 750 Hz.

    There is a further adjustment, from 0 to 0.5 to 1.0 T. This adds up to 1T extra pause between Morse characters. This makes it a bit easier to distinguish individual characters.

    PIC pins;
  • GP0 - button, WPM UP, lo=pressed
  • GP1 - button; WPM DOWN, lo=pressed
  • GP3 - button; Change T, lo=pressed (needs 10k pullup ressstor)
  • GP4 - morse code 750Hz out to speaker, use 500 ohm pot and 180 ohm resistor.
  • GP5 - (not used)

    I connected a small 8 ohm speaker from PIC pin GP4 to ground, through a 500k pot and 180 ohm resistor (all in series). This gave volume adjustment from barely audible to "annoying" although it is not loud.

    Operation. I wanted to build a Morse trainer for a while, that could run in the background while I did internet tasks etc. The user just listens to the beeps and guesses the "word". A quick glance at the LCD shows if they got the word right. This is instinctive and seems a good way to learn while doing other tasks (although beware the beeping has been known to cause wife annoyance!).

    I tried a few systems to see if I could come up with a system to let the user learn Morse without too much effort or boredom. After a while I settled on the 4 second delay, followed by a random 3 letter word which repeats 4 times. This allows full speed Morse learning (similar to Koch nethod) but has a number of benefits as the repeat allows a second or third attempt (etc) to "hear" the word. This is a very "human" way of learning, we all do that "say it again?" thing if we didn't quite make something out.

    There are 26 words of 3 letters, all the alphabet letters are represented. Grouping the letters into words allows for the user to learn the "flow" of letters strung together. The random generator has a 50% chance of making a word, and a 25% chance of just making a single letter or number. This breaks up the session and also allows a chance to identify a single character.

    It seems to work ok. After a couple of easy sessions I was able to recognise many of the words without looking up, even at 25 WPM. I'm sure after enough sessions it would just become second nature that is if your wife doesn't smash "that #%^$& beeping thing" first haha.

    Other uses! This code contains my Morse data table that is very code efficient as it only uses one byte for every Morse character, that byte defines BOTH the length of the character and also its Dits and Dahs. There is also some small efficient code to generate precise "standard" timed Morse (at any WPM) so the code may be useful to adapt to RF devices etc so they can transmit simple data in Morse.

    Source code in MikroC, also HEX file etc; SH1_Morse.zip 23 kb








    Buy Kits here! Shift1-LCD Kits

    Or click here to go back to my Shift1-LCD "how it works" page for more photos and schematics.




    - end -

    [Back to Home Page]