Joe's Hobby Electronics
  • Joe's Hobby Electronics
    • Electronics Blog

Another clock... I love clocks...

15/10/2013

0 Comments

 
I've got a thing for clocks... I wonder if it's because I'm not getting any younger.
Anyway, I had a day free over the weekend and decided It was clock building time.
There's not much to this clock really. A PIC18F25K22 running some simple firmware written in AMICUS18 BASIC. There's a Dallas DS1302 RTC chip with battery backup, and a handful of other components.
I've been experimenting with different firmware to see which makes the display the most readable.
The image on the left of the clock front is showing a time of 10:20:13

UPDATE 29/10/13
I've created a construction project for this clock which can be found here.

0 Comments

PICs, Shift Registers and lots and lots of display digits

17/4/2013

1 Comment

 
Picture
I’ve been experimenting with using a PIC to control long chains of 7-segment LED displays, and to find an approach that I can use to replace the obsolete TIL311 displays. To that end, I’ve created a tech article that describes a simple way to do this. My prototype was 24 digits long; long enough for most applications I think, but could be extended. It’s all done with a PIC18F25K22 running from its own internal oscillator, accepts data from a serial device at 9600 baud, and supports 0 to 9, and A to F value display. The code is written in AMICUS18 BASIC which is free so you can change the software to suit your own application. All the fully documented source code is supplied as well as a schematic of the circuit.

The picure above shows 24 digits (6 x 4 digit modules). The display modules each contain a 4 x 7 segment Common Cathode display, a DIL resisor pack on the modules right-hand side, and there are 4 n-channel SMT MOSFETS underneath.
The advantage of using modules on breadboards is the vast amount of time, and wire that's saved. You can throw a quick circuit together in no-time if you already have the modules pre-built. It also saves a lot of breadboard space.

1 Comment

Completed the Nixie Clock

13/5/2012

3 Comments

 
It’s been a busy couple of days playing with the Nixie Clock but it’s been well worth it.

The firmware for the PIC is completed and running and the main logic board that contains the PIC, RS232 interface, Audio Amplifier, HT and +5v PSU is complete and working.

I had to make a few “modifications” to the wooden case as the display board PCB was slightly too wide and the 7-way Molex connector was catching on the side, preventing the board from sliding into place. Thank heavens for electric files !!

The chap who will be receiving this is a bit of a change freak and loves things that are configurable, so every parameter can be configured by hooking the clock to a dumb RS232 terminal.

There is provision for two temperature sensors to be connected, and you can set alarms if minimum or maximum temperatures on either channel are exceeded. Alarms are either flashing coloured LED’s and/or an audio alert (frequency configurable of course).

There is provision for the CPU to power down the Nixie tubes during a specified time window. This could be useful during the day when the owner will be at work and should help extend the life of the tubes.

The on board RTC (DS1802) can have its date / time  set via a simple command over the serial port, and is also responsible for trickle-charging the on-board NiMH back up battery.

All that’s left to do is fit everything into the case and possibly make a few alterations to the firmware. I’m using just under 25% of the available program space, so theres lots of room available for additional features. I’ve also added an 8-way Molex connector to the top of the PCB that brings out +5v, 0v and the remaining unused I/O pins from the PIC; this will make hardware expansion simpler when it’s required; and it will be required at some point.
I've marked all the connectors so that when enquiring hands take the darn thing apart, it can be put back to gether... that's going to happen at some point as well I suspect.
Picture
Picture showing back wooden panel with interface connector, logic and driver board.
3 Comments

Overheating computer and equipment rooms

29/4/2012

0 Comments

 
The organisation I work for have many buildings and most contain at least one computer or equipment room. In one particular building, the computer room air-conditioning is temperamental to say the least and because people don’t often need to go in there, one more than one occasion the air-conditioner has tripped and it’s been a while before anybody’s noticed the tropical heat wave going on in there.

Yesterday I designed and built a temperature alarm system. It’s nothing too clever, just three large LED displays in a box, with an 18F25K22 PIC running everything. A Dallas 18B20 sensor has been mounted in a small box and is connected via a piece of three-core cable to the main display unit that can be mounted outside the room.

You can set the maximum allowed temperature and this is stored in the PIC’s EEPROM.

If the temperature rises about the pre-set maximum, the display flashes and there are a couple of 5v buzzers inside the main unit to help attract attention.  There are three additional indicator LEDs housed within the main display unit as well. One is a green LED that flashes indicating all is well, a yellow LED that indicates that the unit is in setup-mode (started by powering on the unit whilst depressing the external push-button switch mounted on the side), and a red LED that indicates the temperature alarm has been tripped at some point. Depressing the push-button switch once clears this indicator and the complete unit is powered from a small 9v plug-in mains transformer.

Inside the unit there are two PCBs. One is the top display board, and the other is the logic and PSU board.

If people are interested I’ll publish the design details for this unit.
Picture
Completed unit on the bench being soak-tested.
0 Comments

PIC programming using the AMICUS18 BASIC compiler

17/1/2012

0 Comments

 
Because a lot of people have asked me about PIC programming using the AMICUS18 BASIC compiler and how to do things, I thought it would be interesting and useful if I wrote a series of articles on the subject (see here).

So, to kick things off I’ve placed the first three on this website. I’ve never done anything like this before so please let me know what you think or if there are any topics you would specifically like me to cover.

I’ll be adding more parts on an on-going basis.

You can find the dedicated page here:
0 Comments

Clocks... Clocks... Clocks...

9/1/2012

0 Comments

 
Now I love clocks, I really do. They are great projects because you can place them on the mantelpiece or in other prominent locations as a functional working device, partners can’t complain about it being another piece of junk because they do something useful, they come in all sorts of shapes and sizes and are great beginner projects and once you’ve built it, you can tell people “I made that”.

Recently, I’ve been working on a new clock project and it suddenly occurred to me that except for the physical display aspect of the clock, the internals are nearly always the same. A battery-backed RTC for the date/time (usually a Dallas DS1302) with support components, a PSU section of some type that usually puts out 5v for the logic and possible an additional higher voltage for larger LED displays, a PIC to glue everything together and some display driver hardware.

The only really custom part is the physical display, and the PIC firmware, and this got me thinking; “Can I construct a generic clock that can have many different displays connected, and just need to update the PIC firmware as required”?

So, this is what I’m currently working on. Some more thought is required on some of the projects finer attributes but I have an initial prototype sat on my breadboard that’s driving a strange looking LED display with 60 LEDs on it (I’ll post pictures later) and it seems to be working well.

The next part is to design several other display units and make sure that they can be driven by the hardware.
0 Comments

Digital Evaporator/Incubator and AMICUS18 free PIC compiler.

5/9/2011

0 Comments

 
I recently posted details of a complete construction project for a digital thermometer and clock, partly in response to a request but also because I’d been thinking about building one for a while. Because I wanted this to be an easily maintainable project by anybody, I opted to use the new AMICUS18 free compiler from Crownhill (I already use their PROTON BASIC+ compiler but you have to purchase that though it supports most, if not all, 10F, 12F, 16F and 18F parts). In a nutshell, the AMICUS18 compiler and IDE allows you to write Proton BASIC programs for two specific Microchip PICs, and these PICs just happen to form the core of Arduino compatible CPU boards and shields, so this basically means that you no longer have to work with ATMEL CPU’s exclusively if you want to play with Arduino hardware, and because AMICUS18 is free, this opens up a whole pile of possibilities for project construction, for as long as you limit yourself to a couple of PICs (18F25K20 and 18F25K22), then you can write unrestricted and very powerful code in good old friendly BASIC.

I’ve also realised that whilst there are many web sites containing lots of projects to build, they tend to supply you just a circuit diagram and if you’re lucky, a .HEX files for the CPU. These are ok for seasoned constructors who in reality, probably just want to grab some circuit ideas and wouldn’t usually build the project in it’s entirety in the first place, but for beginners and novices, something more akin to what the great electronics magazines of yester-year used to produce is more appropriate and that’s why I’ve opted to try and provide full construction details for some of my projects.

So, with all this in mind, I’m currently working on another project – an Evaporator.

Ok, actually this is a device that produces a small amount of heat and has a thermometer and timer built in. You set the run time in minutes, maximum temperature you want, and the device attempts to maintain a “hot-zone” at the required temperature for the specified time. In this version of the project, I’m using a 12v / 20w halogen lamp has the heat source and it’s used to gently warm an evaporating basin (small porcelain dish) that’s full of liquid that in turn has a solid dissolved in it. You could use it to recover the salt (and the other solid material) from a few mL of sea-water for example. With a few changes to the physical hardware layout and perhaps a different heating element, you could use this as an incubator. The unit has an LCD display, some push button switches, a temperature sensor, a MOSFET that can switch around 35A if required, PSU section, and a PIC 18F25K22 running some firmware written using the AMICUS18 free compiler; this means you can customise the firmware as you please. One upgrade may be to fit a fan so that if it gets too warm it can cool; perhaps the addition of a Peltier module - the skys the limit when you start thinking about the possible options.

The prototype which is sat on a bread-board right now, works remarkably well. I use PWM (Pulse Width Modulation) to drive the heater (lamp) via the MOSFET. The heat from the lamp is detected by a DS18b20 1-wire temperature sensor (I had a couple spare from my digital thermometer project), and fed back to the PIC. The PIC constantly monitors the temperature and using a very simple algorithm attempts to maintain the temperature by adjusting the brightness of the lamp. Once it warmed up, it was maintaining the temperature to within 0.1 oC which for a first attempt was rather impressive I thought.

I’ll publish full construction details soon, probably when I get back from vacation.
0 Comments

The great religious programming debate – PICs and Programming languages

30/8/2011

1 Comment

 
The one subject that rears its ugly head from time to time and is always a catalyst for a heated debate is “which programming language to use for PICs”, and I am talking about only PICs here, though this is probably the same for many of the embedded type CPUs available.

Assembler is the best to use as it allows the developer to get as close to the PIC hardware as possible, gives the most flexibility and offers the best performance, and this is true… to a point.
It’s also the most complicated as many simple tasks require a lot of assembler instructions, so there’s more you have to type, so more you can get wrong. On the flip side, you have the opportunity to fine tune the program and validate the need for every instruction within your program. Another problem is that every CPU manufacturer has their own assembler and instruction set and it can be a real pain moving from one CPU manufacturer to another. Often, the same manufacturers often use different assemblers and instruction sets for different CPUs that they make.

For the best performance and the tightest control, in the hands of a highly skilled programmer you can’t beat assembler, but you have to know exactly what your doing and you stand an equal chance of creating slow, bloated and buggy code.

“C” – is a higher level language than Assembler which means that it shields the programmer from some of the nitty gritty issues that Assembler has. It’s easy to read but like any programming language, if you don’t know what you’re doing, you can make a complete pigs ear of things.

The advocates of “C” will brandish around phrases and words like “ANIS compatible”, and portable. Unfortunately, in the PIC world, one also has to brandish around the word “rubbish” as well.  “C” as a programming language has only a few instructions associated with it. Most of the really cool features like talking to the A2D ports or the I2C hardware within the PIC are actually performed by 3rd party libraries; there is NO native support within the "C" language for this. Usually supplied with the language installation, some of these libraries are written in Assembler, some written in “C” but they aren’t standard across all “C” implementations. This means that “C” from Microchip is different from the “C” version from FED so you can’t just cut and paste source code and watch it re-compile without a page full of warnings or errors.

Now my favourite, BASIC.

I can hear the groans and moans about how BASIC is slow and bloated. RUBBISH !!!!

BASIC comes in two main flavours; compiled or interpreted. Interpreted BASIC’s are usually slower than compiled languages and that’s a fact, but you get a bit more flexibility. For example, you don’t always need a PC (or a PIC programmer) to program a PIC that’s running interpreted BASIC; a dumb terminal will often suffice. (Yes, you can get boot-loaders, but they still usually need a PC unless you use a PICKIT with it's on-the-go programming feature and these don't allow you to develop new code; just flash the device with a pre-built HEX file).
Also, interpreted programs are often simpler to debug as you can stop them mid way through execution and look at variable contents. However, speed and code size are usually more important than ease of development once you've passed the pure beginner stage.

Compiled BASICs are no slower than “C” programs and I’ve timed them to prove it !!

All the “C” compilers that I’ve found work in the same way. They parse your “C” source code, spit out a file containing PIC assembler, and then pass that assembler to the standard Microchip assembler to generate the .HEX file for the PIC. And why not? There's no point creating your own assembler as the Microchip one is maintained by the supplier, is free, and rather good at what it does.

The BASIC compilers tend to work in exactly the same way.

The ONLY thing that makes one compiler better than another is the tightness of the assembler code it produces and the quality of the associated libraries and code optimiser and this rule is programming language independant.  I compared Proton+ BASIC with Microchip “C” and found no difference in the speed of execution for some simple tasks.  Some differences were noted when using some library routines and there were swings and roundabouts with both.

Yes, it’s possible to write slow and bloated code in BASIC, but that’s also true in “C” or any programming language.

Some of the cool features like bit manipulation that are common in "C" but not often found in PC type BASICs are fully supported in PIC BASICs.

The bottom line is find a programming language you like, learn it well, and you should be able to write fast and efficient code.

The "thing" about BASIC; nobody expects it to be portable or "standard".
1 Comment

    Author

    A software and hardware engineer who loves retro computers.

    Archives

    March 2022
    September 2021
    April 2021
    June 2020
    May 2020
    April 2020
    March 2020
    September 2019
    January 2019
    April 2018
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    May 2015
    April 2015
    March 2015
    January 2015
    December 2014
    September 2014
    August 2014
    April 2014
    March 2014
    January 2014
    October 2013
    September 2013
    August 2013
    July 2013
    June 2013
    April 2013
    March 2013
    January 2013
    September 2012
    June 2012
    May 2012
    April 2012
    February 2012
    January 2012
    December 2011
    November 2011
    October 2011
    September 2011
    August 2011
    July 2011
    June 2011

    Categories

    All
    18f25k20
    18F25K22
    1-wire
    2114
    2764
    3D Printer
    3D Printing
    74hc595
    74ls595
    86-0325
    8MHz
    Access Speed
    Acorn
    Acorn System 1
    Alarm
    Aluminium Panel
    Amicus
    Amicus18
    Amicus Basic
    Amplifier
    Antex 1107
    Anti-static Mat
    Arduino
    Assembler
    Backlight
    Bargains
    Basic
    Bat
    Batdetector
    Bat Detector
    Bats
    Bench Audio Amplifier
    Bench Light
    Breadboard
    Bubbler
    Buck
    Bug
    "C"
    Cable
    Cable Gauge
    Cable Wire Size
    Capacitors
    Catalogue
    Clive Maxfield
    Clock
    Clocks
    CMOS
    Common Emitter
    Compiled
    Compiler
    Connector
    CPU
    CPU Simulator
    Crownhill
    Custom Computer
    Custom CPU
    Damage
    Develop
    Diode
    Diptrace
    Double-sided
    Double-Sided PCB
    Dry-joint
    Ds1302
    DS1820
    Ds18b20
    Ebay
    EEPROM
    Electronics And Circuits
    Eprom
    Erase
    Etch
    Evaporator
    Failed Capacitor
    Fake
    Fax Paper
    Ferric Chloride
    Fire Hazzard
    Firmware
    Florescent Tube
    Health And Safety
    Hidden Part Numbers
    High-Voltage
    Hv
    IC Test Clip
    IC Testing
    In Circuit IC Testing
    Incubator
    INS8154
    Instruction Set
    Inverter
    Kickstarter
    Laser Cutter
    Lcd
    LM2596
    LM386
    Logic Analyser
    M7MOJ
    Maxim
    Maximum Current Rating
    Mega
    Mit
    MITx 6.002
    MK4
    Molex
    Mosfet
    NE555
    Nixie
    Nixie Clock
    Npn
    OXO
    Oxo Machine
    Pcb
    Pic
    Pic Basic
    Pickit2
    Pickit3
    Pic Programmer
    Pixy
    Poster
    Pre-amp
    Prices
    Programming
    Project Box
    Project Case
    Project Enclosure
    Propagation Delay
    Psu
    Psu Failure
    Qfn
    RAM
    Rapid Electronics
    Raspberry Pi
    Regulated 5v Psu
    Regulator
    Repair
    Review
    SAD (Segment Address Decoder)
    SCC
    SCC MK4
    Seven Segment Display
    Shift Register
    Silient 700
    Slow Progress
    Smoke
    Smps
    Soldering
    Speed
    Speed Test
    Stepper Motor
    Supression
    Swg
    Switch Box
    Tank
    Tantalum Capacitor
    Temperature
    Temperature Sensor
    Texas Instruments
    Thermometer
    Tic Tac Toe
    Tic-tac-toe
    Timer
    Tools
    Traffic Lights
    Transistor
    TTL
    Usb
    Uv
    Vbe
    Vcb
    Vce
    W65C02
    Wash
    Weller
    Wirecutters
    Wire Cutters
    Wire Strippers
    Wiring
    Wp3eu
    X2 Capacitor
    X Capacitor
    Y Capacitor

    RSS Feed

© Joe Farr, 2011 - 2022 - Email: HobbyElectronics@kcsl.uk.com