Welcome to the N1IR Electronics Website. Totally off the cuff, one take, unrehearsed video projects for anyone interested in amateur radio, electronic design, makers, hardware hackers and science.


Get off you duff and build something!
Training the hand and mind since 1982.

Friday, October 25, 2013

Replacement Project, Musical PIC PART 2

Well just finished the replacement  Musical PIC project, used a ATMEGA328, I know, I know, it's over kill but I've got over 600 of them in stock in the shop. I used the Arduino IDE and the TONE library.


One problem I ran into was the newest Arduino 1.0.5 did not work with the old TONE library, it got stuck on wiring.h in the TONE.CPP file, just change In \libraries\Tone\Tone.cpp change #include <wprogram.h> to #include <arduino.h> 


and bingo work again. I also used the rttl example program that came with the libary. This you can find any RTTL ring tone and use it, the example program come with about 20 or so songs, all you have to do is remove the comment // to the song you would like to burn on the IC.





Below is a schematic 






PCB Design Coming Soon !!!

If you refer to the schematic, there is no ICSP pins. You must use the Arduino platform first and program then remove the IC and place it in the newly programmed Arduino IC on to the PCB you just made.

Once this is done simply get a new ATMEGA328P-PU and burn a boot-loader using Adafruits USBtinyISP programmer. This eliminates the need to buy a new Arduino platform at $30, all you are doing is replacing the IC with the newly burned IC with boot-loader at around $1.00 each.

It's important to use the ATMEGA328P-PU version, the ATMEGA328-PU has a different chip Hex ID. You can still use the -PU IC but you have to change the embedded AVRdude Utility in the Arduino IDE and change the ID to fool the Arduino IDE to burning the boot-loader. 

What's the difference between the ATMEGA328P-PU version and the ATMEGA328-PU, not much the P-PU has a micro current sleep mode.

Notes:
I deleted the two 22pf caps hanging off the crystal to make the project cheaper and used a 200 ohm resistor to limit the current to the 8 ohm speaker. This eliminated the need for a driver transistor. 

Overall cost of the project

Speaker = Free from donation (we have over 400 new 2" SPK)
ATMEGA328 = $1.00 in bulk
Resistor = less that $0.01
Xtal = $0.50
PB SW = Free from donation (we have over 5000 in stock)

If you were to buy from digikey or jaycar it would probably be under $5 USD

Replacement Project, Musical PIC PART 1

Well one of our staple project for our fresmen bit the dust. It was called the Musical PIC. The problem was I had a invalid HEX file, checksum error for some reason.

Back 5 years ago it was great project but it had a few drawbacks. First it used a PIC12C508 OTP. Yep One Time Programmable, what a pain in the a$$ if you need to change code. Burn change, burn change and rinse and repeat till you get it right, meanwhile at $0.50 a chip development of anything got expensive. Second I only had a couple of songs, I'm not musically inclined so figuring out songs to assembly language (ASM) was a real pain.

Well here is the original article with the 12C508.

A very simple PIC project to try. With the basic program available to download below you can insert any tune you like. My three year old son likes this Teletubbies tune. With a little more circuitry I wired it to the door of the car. Everytime he closed the door the car plays the Teletubbies tune. It was wired from the 0V of the car body to the wire that connects to the door switch. When the door is opened the supply to the PIC is shorted. When the door is closed the supply is reinstated and the PIC restarts its program again. Alternately it could be powered off batteries and hidden inside a childs toy.
 Hex code
:020000040000FA
:100000002500490A540855084E0845082008560896
:1000100031082E0830080B02E2016808C208010806
:100020006808960800087F08F60800086808DE08D7
:1000300005085E0898080208770827080608680877
:10004000580802087F08C40805088D08ED0806084E
:100050006808C20801086808960800087F08F608C2
:1000600000086808DE0805085E08F20801085E0856
:10007000A60800087708060801085E087E0806083A
:100080006808B10804085408D00805085008350865
:100090000C082A0C2600400006006B005809620973
:1000A0003C0C8B0043074E0AFF0C06000300490A74
:1000B0000B092700AB020B092800AB020B09290032
:1000C000AB020008A90207026B096602E802630A94
:1000D000E902630A00082A00000000000000000096
:0800E0000000EA026C0A0008AE
:021FFE00EA0FE8
:00000001FF


ASM File
; FILE            TUNE.ASM
; FOR            12C508A
; CLOCK       Internal

    TITLE "TUNE Program"
    LIST P=12c508a
    include p12c508a.inc

    ;config settings for PICSTART Programmer
    __CONFIG _IntRC_OSC & _CP_OFF & _WDT_OFF & _MCLRE_OFF  

    constant noteLG    =.159        ;G note constants
    constant noteA    =.141        ;A
    constant noteB    =.127        ;B
    constant noteC    =.119        ;C
     constant noteD    =.104        ;D
    constant noteE    =.94        ;E
    constant noteFS    =.84        ;F#
    constant noteG    =.80        ;G

    constant MINIM =.250000        ;note length constants
    constant SEMIN =MINIM/2
    constant CROTCH =SEMIN/2
    constant QUAVER =CROTCH/2
    constant SEMIQV =QUAVER/2

NOTE    macro freq,length
    retlw freq
    retlw low ((length) / freq)
    retlw high ((length) / freq)
    endm

    ;File registers
    org 7
freq    res 1
len    res 1
lenh    res 1
frq    res 1
tabpos    res 1

    org 0
    movwf OSCCAL
    goto start

    retlw 'T'    ;chip identification
    retlw 'U'
    retlw 'N'
    retlw 'E'
    retlw ' '
    retlw 'V'
    retlw '1'
    retlw '.'
    retlw '0'

tune    movf tabpos,w
    addwf PCL,f

    ;example tune
 
tunest     
    NOTE noteC,CROTCH    ;1

    NOTE noteD,CROTCH    ;2

    NOTE noteF,QUAVER    ;3

    NOTE noteE,QUAVER    ;4

    NOTE noteD,QUAVER    ;5

    NOTE noteC,CROTCH    ;6

    NOTE noteG,CROTCH    ;7
     
    NOTE noteF,QUAVER    ;8

    NOTE noteE,QUAVER    ;9

    NOTE noteD,QUAVER    ;10
     
    NOTE noteC,CROTCH    ;11

    NOTE noteG,CROTCH    ;12
     
    NOTE noteF,QUAVER    ;13

    NOTE noteE,QUAVER    ;14

    NOTE noteF,QUAVER    ;15
     
    NOTE noteD,QUAVER    ;16
     

endtab                ;end of tune

start    movlw b'00101010'    ;set outputs
    movwf GPIO
    clrw 
    tris GPIO        ;GPIO all outputs
    clrf tabpos        ;reset table position
nxtnote    call getnote         ;get note from table
    call play        ;play note
    movlw endtab - tunest    ;check if at end
    subwf tabpos,w        ;of table
    btfss STATUS,Z
    goto nxtnote        ;no then get next note
     
    movlw b'11111111'    ;set outputs to high
    tris GPIO        ;impedence input mode
    sleep            ;put PIC in low power mode
    goto start        ;re-start if woken up

getnote    call tune        ;get note from table
    movwf freq
    incf tabpos,f
    call tune        ;get length lower byte
    movwf len
    incf tabpos,f
    call tune        ;get length high byte
    movwf lenh
    incf tabpos,f
    return

play    incf lenh,f
play2    movf freq,w
    call note        ;wait 1/2 frequency
    comf GPIO,f        ;toggle sounder
    decfsz len,f
    goto play2        ;keep looping until
    decfsz lenh,f        ;note finished
    goto play2
    return     

note    movwf frq        ;wait 1/2 of frequency
wait    nop                     
        nop
    nop
    nop
        nop
        decfsz frq,f
        goto wait
        return 

    end


Thursday, October 24, 2013

This old arcade console

Got an old arcade console in the other day. Totally dead, found a bad switching power supply. Believe it or not power consumption to the CPU board is very small at about 25 watts, surprising considering all the logic is discreet 74XX series. This was a donkey con knock off. Here are some pics

 Replacement SMPS, notice the isolation transformer in the center, 
the original was totally burnt up with heat damage.

Console Front

Inside cabinet, in fact one of the RAM IC was decapped and still working


 Close up of CPU board, two large MSI chips one for sound and one main CPU, tons of ROMS and standard 74XX series logic


November 1981


Thursday, October 17, 2013

November General Course, HAM Radio


The General Course for November is a go! If you know anyone who is interested in taking the General Course please pass this on. Thanks to all that volunteer without your effort the hobby and this class would not be a success.

Call out to volunteer instructors, anyone wish to teach a section please email me.

Location: Plymouth Airport

Sunday November 17 ; 8AM to 4PM (elements run roughly 1.5 hours)
8:00-9:30 G1 – Commission’s Rules (N1IR, Chris)
9:30-11:00 G2 – Operating Procedures (KB1EVY, John)
11:00-12:30 G3 – Radio Wave Propagation (OPEN)
12:30-1:00 Lunch (30-45 min)
1:00-2:30 G4 – Amateur Radio Practices (Mike B.)
2:30-4:00 G5 – Electrical Principles (N1IR, Chris)

Sunday November 24 ; 8AM to 4PM
8:00-9:30 G6 – Circuit Componets (N1IR, Chris)
9:30-11:00 G7 – Practical Circuits (N1IR, Chris)
11:00-12:30 G8 – Signals and Emissions (OPEN)
12:30-1:00 Lunch (30-45 min)
1:00-2:30 G9 – Antennas (Mike B.)
2:30-4:00 G0 – Electrical and RF Safety (KB1SRO, Judy)

Testing Sunday November 24 4pm to 5pm Enrollment
VE's:
N1IR
KB1SRO
KB1EVY

Student Roster:
Kb1WWV Bob

Thank for you support
CJ, N1IR

October Update

Hello all,

Sorry things have been busy lately. I'm taking an online course at Fitchburg State CSC 1050 Internet Communications and learning a lot. Believe it or not this is my first "real" college course in computers. I've been into computers since my first PC back in 1982 the IBM 5150 (8088) and have been self taught with computers since. I'm and old DOS guy but worked with all windows from windows 286 up to now Windows 8 and switched over to linux since Ubuntu 8, never going back to windows again, lol. 

For those of you who need to feel nostalgic check out http://www.youtube.com/watch?v=JnSz-Hb9LQY BBS the documentary. I actually owned and ran a BBS myself back in the early 90's and my number was 617 826 7134. I still run a radio packet station with ham radio at 1200 baud and connect to the N1RCW Packet BBS

Well enough ranting got to get back to work.