Skip to main content
Topic: Parts for Breadboard & Schematic Questions (Read 27625 times) previous topic - next topic

Parts for Breadboard & Schematic Questions

1) I made a list of the parts I'd need to make this circuit in a breadboard (@ Mouser):


C1-4  80-C052C104M5R5CA (0.1µF)  Capacitor (x4)
C5-6  80-C052C270K2R5CA (27pF)  Capacitor (x2)
D  512-1N4148 (≤6ns, 0.2A)  Diode Rectifier (Ultra Fast Recovery)
IC  579-PIC18F2550-I/SP (28-pin, 32K, USB)  Microchip Microcontroller
Q  815-ABL-20-B2  (20MHz)  Clock
R1  270-10K-RC  (10KΩ, 1/8W)  Resistor
R2  270-2.7K-RC  (390-2700Ω, 1/8W)  Resistor - LED (I)
R3  270-390-RC  (390Ω, 1/8W)  Resistor
R4  270-180-RC  (180Ω, 1/8W)  Resistor
R5  270-1K-RC  (1KΩ, 1/8W)  Resistor
T  512-BC33840BU  (NPN, 5V, 0.2A+, HFE/30+) Transistor
351-5022-RC  (1.7V, 30mA, 5mm, Red)  LED Standard (Diffused)
RX  782-TSOP38238  (38KHz)  IR Receiver Module
TX  782-TSAL5300  (940nm)  IR Emitter LED
S  653-B3F-1060  (Off-(On), 6mm)  Tactile Switch


2) Can I program the PIC µC with the Bus Pirate (SPI mode), using the ICSP header &
    AVRDude (Windows XP)?

3) What would be a simpler circuit, without the PIC µC, in these two situations:

     a.  only want to control the PC with Girder (UART serial cable or USB<->serial adapter)

     b.  only want to reliably store a remote control's commands (can code a C# program),
          and later save the codes to another learning RC

Re: Parts for Breadboard & Schematic Questions

Reply #1
Hey liyin,

1. A 1n4148 will work fine.
2. No, sorry, the AVRDude programmer only programs ATMEL AVR chips (and probably some EEPROMs). The PIC18 also needs a 13volt programming voltage that the Bus Pirate can't create.
3. There are lots of old serial port interfaces that can do that (with the right operating system, accurate timing is hard on later versions of windows). Check out the lirc and wlirc projects.
Got a question? Please ask in the forum for the fastest answers.

Re: Parts for Breadboard & Schematic Questions

Reply #2
1) Just about any diode will work if you are building on a breadboard. Look at the Reset chapter of the PIC18F2550 Data Sheet, Figure 4-2, and you will see that the diode is used to condition the MCLR signal for reset. They do not give any particular parameters for this diode, so I imagine that just about anything will work. Might as well make sure it can handle at least 500 mA, but I'm not quite sure how to calculate the maximum current when shorting out the capacitor shown in the Microchip circuit. However, the USB IR Toy does not actually have the pull-up resistor or Power On Reset capacitor, so I'm not sure that the diode is even needed at all. Microchip points out that it is there to discharge the capacitor, so you can probably skip it entirely.  Alternatively, you have the option of implementing the full circuit shown in the Data Sheet, with the capacitance and resistance recommended by Microchip.  Since you're using a breadboard, it should be a simply matter to add this.  I have learned that each PIC model has slightly different requirements for MCLR conditioning.

2) The PICkit 2 programmer is only $34.99 from Microchip, and less from vendors like PIC16.com, so I wouldn't bother hacking something that might not work.  AVRDude might be specific to the AVR.  As far as I know, the AVR series does not usually contain an internal Flash memory, so there could be quite an incompatibility. This does seem like a good question for the Bus Pirate forum, since general programming of any PIC would be a useful feature.

3) If you simplify the circuit, especially by removing the PIC, then you will lose compatibility with certain devices. It's certainly possible to cover a large subset, but you will lose something.

3a) This is an interesting question. I recently considered the question of why the USB IR Toy was not designed to simply use the UART that is built in to the PIC.  I quickly answered my own question: IR Remote Control protocols are 14 bits long, and that generally is beyond the capabilities of most UART peripherals except those on a DSP (which is well beyond the capabilities of a PIC unless you upgrade to dsPIC).  Not only are the Remote Control signals 14 bits long, but they are Manchester-encoded, meaning that they're really 28 bits long if you don't have the benefit of a hardware decoding circuit for the Manchester data format. Girder probably does not have the precision to handle 14-bit Manchester codes over the UART. You're on your own figuring that out, but get back to us if they claim to support 14-bit Manchester or 28-bit UART modes.

3b) There is no guarantee that any given remote control is using a standard protocol.  The USB IR Toy is designed like a logic analyzer, so that you can discover the protocol even when it is unknown. If your goal is to store a particular remote control's commands, then you'll need to know in advance which protocol your remote control is using. The USB IR Toy is a great tool to discover which protocol your remote control uses. However, it's also possible to do a little research online and discover which protocols your particular collection of remote controls use, and then you might be able to design a simpler circuit. But be warned that without the PIC, you might need additional circuits to convert the Manchester codes to normal bits. If you're interested in that, feel free to follow up here after you've confirmed which protocol you need to implement for your particular collection of remote controls.

Re: Parts for Breadboard & Schematic Questions

Reply #3
I too am interested in building this device on a breadboard, 1) to get more I/O lines, 2) for the learning experience.

Thanks for the PICKit2 recommendation.   I don't currently have any programmers as I've only been doing Arduino work.

Is there a programmer that will handle both PICs and AVRs?

I suppose one route would be this bus pirate pic programmer adapter, any updates on this?
http://dangerousprototypes.com/2009/12/ ... er-update/

Also "one bus pirate programs another" talks about PIC 24F's used in the Bus Pirate which don't require 13V.
http://dangerousprototypes.com/2010/04/ ... s-another/

Would it be unreasonable to build a USB IR Toy equivalent using a PIC 24F?   I realize some porting of the code would be required.

Thanks,
--Rob

Re: Parts for Breadboard & Schematic Questions

Reply #4
Take a look in the buspirate development, there are several topics about PIC programming:

http://dangerousprototypes.com/forum/in ... opic=412.0
http://dangerousprototypes.com/forum/in ... opic=423.0

AVR programming can be done with the stk500 firmware, although I managed to do it (lvp only) on a atiny85 with a normal buspirate ( http://dangerousprototypes.com/forum/in ... 92#msg2992 )

And one about the adapter (a more recent version then you refered to.)
http://dangerousprototypes.com/forum/in ... opic=265.0

Re: Parts for Breadboard & Schematic Questions

Reply #5
1) Thanks Ian, rsdio, things are making more sense now. The good thing about breadboards is that I can try all those options rsdio mentioned. Is funny cause I was expecting the breadboard to be a big block of plastic, and the damn thing is so small.

2) Ja! An AVR programmer for a PIC, why didn't I think of that ... wait ... I did!  :3  It was quite late when I posted. If you want to avoid a heart attack use this link for the site rsdio recommended: http://www.pic16.com/en/.

I was checking this simple programmer http://www.instructables.com/id/Business-Card-PIC-Programmer/. The author says: "I've programmed everything from an 8 pin 12F629 to a new 18F4550 USB PIC with the JDM2".   <= LOL, this is Ian!

Could this work? Sounds simple enough for a breadboard project.

3a) WinLIRC is old, and the schematics lack a µC. Do you know of a good, current schematic, with working µC code, that uses the ATtiny13A µC?

http://www.serasidis.gr/circuits/InReCoMe/InReCoMe.htm   <=  Better than this!

3b) I was asking for a simpler circuit because the BP has a logic analyzer mode, so I'm looking for something like this: IR signal => IR circuit => BP => PC. If I already have a BP connected to the PC, I think I can control the BP via a C# program using serial commands to automate the process.

rsdio, your post is excellent, very informative, thanks!

Re: Parts for Breadboard & Schematic Questions

Reply #6
The USB IR toy can be used with SUMP just like the bus pirate for logic analyzer mode.

Also, all you need is an IR detector to use the Bus pirate to capture IR signals for SUMP.   I used a panasonic PNA 4602 (part number from memory)

Re: Parts for Breadboard & Schematic Questions

Reply #7
1) There are breadboards and there are perf boards (perforated). You can find a big block of plastic, sometimes even mounted on a slab of aluminum, but sometimes smaller like you have is better.

2) Some of the PIC chips do not need more than 5V to program. Go to the Microchip site and look at their web selector. You can check boxes for USB and programming voltage, plus select packages that work on a breadboard, and see what options there are. I've used the PIC18F67J50, which needs only 3.6V maximum for programming, but it is SMD only, so you can't use it on a breadboard.

NOTE: The first programmer that I purchased from PIC16.COM burned out when my client made the board with VPP shorted to ground!  I was able to fix it by looking for the smudge of smoke on the plexiglass cover which made it obvious that one transistor had burned out. It's SMD, so it was quite a trick to repair without damaging anything else. I bought a couple of spares before upgrading to the official Microchip PICkit2, which was only $5 more at the time. The advantage of the PIC16.com is that it has a cable so you can program boards where the PICkit2 from Microchip won't fit - e.g. the USB IR Toy cannot be programmed with the Microchip programmer if you have the straight ICSP header, but I see in the photos that Ian has a USB IR Toy with a right-angle ICSP header which would work. Another thing to note is that the price of the PIC16.COM product has gone up now that they have a plastic case over the whole thing. Mine looks more like a Dangerous Prototype, but I can tell from the alignment of the LEDs and button that the new model is just the old PCB in a new case. With the price increase, I can't say it's worth ordering from China unless Microchip is out of stock and you are in a hurry.

3a) Good question. I'd have to look at the schematics and software for the WinLIRC and figure out how it works before I could say anything worthwhile. If you've got more detailed knowledge about WinLIRC, then maybe you can figure it out. With the right circuit, the computer has less to do, and thus the timing and bit length becomes less of an issue. However, the WinLIRC circuits that I found were very basic, meaning that the computer must handle the Manchester coding, and must create 28-bit codes. Perhaps WinLIRC uses buffering inside the UART to concatenate more than one serial word together, without a timing gap, to get the longer bit sequence. Without code-reviewing WinLIRC, there's no telling how well it works. I did notice some brief comments on the random Google hits that I found which mention that WinLIRC is not very reliable. That might be very important to consider when comparing the USB IR Toy or your own PIC breadboard solution with WinLIRC.

3b) I'm new here, so I haven't looked at the Bus Pirate in detail. I'm sure 'rct' is correct: You should be able to make a simpler circuit to convert IR to voltage and use the BP instead of the USB IR Toy, since you already own the BP. Since you're on a breadboard, I suggest that you follow the links to San Bergmans' circuit, which uses a small number of cheap parts to create a constant current source instead of one where the current varies with the voltage. This allows you to get the maximum range from your IR transmitter. Make sure that you check your part number and get the spec sheet for your IR LED to confirm the maximum steady current that it can handle (not the higher pulsed current, since you can't be sure your firmware pulses won't be too long). You'll also have to make sure that the forward voltage of your IR LED is not too large compared to the power supply voltage, or else the circuit won't work.

http://www.sbprojects.com/knowledge/ir/ir.htm

I say go for it. The Bus Pirate should be a fine platform for USB IR experimentation, provided you can write firmware, program the chip, and breadboard the right circuits.

Re: Parts for Breadboard & Schematic Questions

Reply #8
I edited 3a) after reading Ian's article @ Hack-A-Day:

"Computer infrared receivers

The oldest PC infrared receiver design uses a receiver IC to toggle a serial port pin, usually DCD ... These aren’t true serial devices because they don’t send data to the PC. Instead, a computer program times pulses on the serial port and demodulates the signal. This is a super simple design, but it depends on direct interrupt access and timing precision that’s no longer available in Windows ... We couldn’t get this type of receiver to work with the serial port on a modern Windows XP PC, and don’t expect the precise timing to transfer through a USB->serial converter.

Some more advanced infrared receivers are true serial port devices that measure or decoding infrared signals before sending data to the computer."

And then you get a post like this one:

"I built the Lirc receiver one day on a whim, and I still use it along with The Korean media player. Works fine on XP with a serial port to usb Adapter, been using it now since around 2004 no problems at all. It is also a good way to check if a remote control is actually working as well, with Wlirc’s debug options.
Posted at 8:12 pm on Oct 30th, 2008 by theweirdness"

Re: Parts for Breadboard & Schematic Questions

Reply #9
The JDM2 should program the 18F fine, I used it for that for a long time before I got a real debugger. It uses a negative ground to get 13volts, so make sure any power supply is disconnected.

The 24F could be used for something like the USB IR Toy, but it doesn't have a USB port so it would be serial or need an FTDI chip (like the bus pirate has).

Yeah, I remember that comment on the hack a day article. I don't think it will work for 99 out of 100 people, it wouldn't work on any of our test computers with XP (fine in Linux and Win2000). And we tried, I mean really tried, it was supposed to be a HaD project but it wouldn't work on modern OSs. It could always have been something I messed up, or someone has just the right setup, etc.
Got a question? Please ask in the forum for the fastest answers.

Re: Parts for Breadboard & Schematic Questions

Reply #10
It's good to know about the JDM2 if you still have real serial ports around.   I'm assuming you also need an rs232 port that is closer to the -12V <-> +12V than the 0-5V that semi recent pcs have.

Will the Bus Blaster be able to program PICs & AVRs (w/o JTAG interfaces)?   Will it have the 13V for the PICs that need it?

Thanks,

Re: Parts for Breadboard & Schematic Questions

Reply #11
[quote author="rsdio"]As far as I know, the AVR series does not usually contain an internal Flash memory, so there could be quite an incompatibility.[/quote]
Oops, I was thinking of the DSP chip that I'm designing with that doesn't have Flash. Lots of AVR chips have internal Flash, although they're typically much smaller than the PIC Flash at the same price point. But the bottom line is that programmers generally don't handle both.

Re: Parts for Breadboard & Schematic Questions

Reply #12
Yup, the wimpy serial port is the 'death' of the JDM2 :) They often wouldn't work on laptops (+10 swing) and now on modern desktops too (if they have a serial port)...

The Bus Blaster will be primarily for JTAG and flash programming with OpenOCD and flashrom. I believe OpenOCD programs AVRs through thier simple SPI programming interface, I don't think it does PICs. The Bus Blaster won't have a +13V power supply for PICs, but ti could be done with a breakout board if someone wanted to develop the software to do it.

You might also check out this, 10/12/16/18/30 programming with the Bus Pirate was just uploaded last night:
http://dangerousprototypes.com/forum/in ... 98#msg3998
Got a question? Please ask in the forum for the fastest answers.

Re: Parts for Breadboard & Schematic Questions

Reply #13
Possible alternatives for the PIC18F2550 available in in SDIP/DIP packages for breadboarding are
- PIC18F2455 (SDIP-28 package) has only 24k compared to 32k program memory - not sure if that's enough for the USB IR Toy firmware
- the 40-pin version PIC18F4550-I/P (DIP-40 package) or
- the 28-pin PIC18F25J50/PIC18F26J50 (SDIP-28 package) - I think it's pin-compatible but not code-compatible with the PIC18F2550 or
- the 16-Bit PIC24FJ32GB002/PICFJ64GB002-ISP (SDIP-28 package) - the PIC24FJxxxGBxxx family has a USB port and can
  be considered the big 16-Bit brother of the PIC18F2xJ50 (not pin- and code-compatible, so!)

In all cases the code will have to be adapted to the specifics of the MCU and recompiled.

For a programmer the PICkit2 is an affortable and versatile tool. It can even be used to program various Atmel AVRs,
Ian posted about PK2AVRISP on his blog a few days ago:Program your AVR with PICkit2

Re: Parts for Breadboard & Schematic Questions

Reply #14
- I saw the PIC18F2455 was the PIC18F2550 with 24K Flash memory, but USBIRToy.hex firmware is ~25K. I read about PK2AVRISP at the blog, sounds like a good option.

  Bus Pirate PIC programmer update
  http://dangerousprototypes.com/2009/12/10/bus-pirate-pic-programmer-update/

  C programmer needed for PIC support!
  http://dangerousprototypes.com/2009/11/25/c-programmer-needed-for-pic-support/

- I noticed 2 IRRX lines @ pins 25 & 23, and the line coming from RX. How does that work?

- What are PGD & PGC @ pins 28 & 27?

- I understand I can connect the Bus Pirate to pins 18 & 17 (UART data), and ignore pins 16 & 15 (USB data)?

- What's the purpose of having two capacitors in parallel @ pin 14 (VUSB) going to ground? USB VBUS provides Vcc.

- Can't I just capture the raw IR signal without the need to decode first (using Bus Pirate)? How is it possible for a learning remote control to save/replay so many different protocols (TV, DVD, Sat, Air Conditioner, Death Star, etc)?