Trying to make wall avoiding robot

SgtWookie

Joined Jul 17, 2007
22,230
I've got the datasheets on the IR Led and the IR Receiver (WARNING: Those are links to .pdf files!)
OK. Haven't looked at them yet, but it'll help!

Re: fixed V+ vs VCC
Fixed the above...
Oops - you simply re-named or re-valued the V+ symbol to VCC. That's not so good. Delete that symbol, and replace it with either a copy of another VCC symbol that's already on the sheet, or from the library. Re-naming/re-valuing supply symbols is NOT a good idea, as that can change the names of symbols or power rails throughout the schematic, causing big problems later.

Also, you added /RESET in the wrong place; it needs to be between the 10k resistor and pin 1 (/RESET). Otherwise, if you tried to use the /RESET signal as intended, you would short VCC to ground. :(

[/QUOTE]Also added a 6 pin ISP Header - I think I've got it connected properly (It looks nice, too!)[/QUOTE]
I don't see the ISP header; however I DO see what looks like re-named supply symbols. I'm afraid that won't work very well, as the supply symbols aren't physical parts; they are basically labels. They give a visual indication that they are connected somewhere else in the schematic, and also re-Name the signal that they are connected to. You need to find out what kind of connector is required to connect to the programmer harness, and hook it up in the schematic. If there is no symbol in a library for it, you'll need to create one.

Re: IR LED intensity
Could I use PWM instead of resistors? Or does that only work on motors?
PWM is basically turning the power ON and OFF at varying intervals. If we were talking about general lighting, where persistence of vision of the human eye would average out the light intensity, or motors which have inductance to keep the current flowing when it's cut off, that would be different. The response time of the IR Receiver is very quick. This needs to be looked at some more.

Here's the updated schematic:
(removed link)
EDIT: I noticed that if I were to plug in a programmer to the ISP Header, both the L298 and the micro would receive power from the programmer. Should I add a switch between the VCC pin and VCC on the L298 to turn off the L298 while the micro is programming? (Would it matter if it did get power though, because the motors would still remain OFF?)
You could add a jumper, like those used on disk drives. Pins spaced 0.1" apart. Cheaper and smaller than a switch.

I also noticed that VCC on the RESET pin of the micro is an arrow and not a circle. Does that mean anything?
Explained above, but to re-iterate; delete it and add/copy an un-edited symbol.
 

Thread Starter

Qaptian

Joined Oct 27, 2008
37
Oops - you simply re-named or re-valued the V+ symbol to VCC. That's not so good. Delete that symbol, and replace it with either a copy of another VCC symbol that's already on the sheet, or from the library. Re-naming/re-valuing supply symbols is NOT a good idea, as that can change the names of symbols or power rails throughout the schematic, causing big problems later.
I changed it to another VCC symbol, should be correct now.

I don't see the ISP header; however I DO see what looks like re-named supply symbols. I'm afraid that won't work very well, as the supply symbols aren't physical parts; they are basically labels. They give a visual indication that they are connected somewhere else in the schematic, and also re-Name the signal that they are connected to. You need to find out what kind of connector is required to connect to the programmer harness, and hook it up in the schematic. If there is no symbol in a library for it, you'll need to create one.
Check out the schematic below, I used a piece that looks similar to a header connector and wired it up according to this website.

PWM is basically turning the power ON and OFF at varying intervals. If we were talking about general lighting, where persistence of vision of the human eye would average out the light intensity, or motors which have inductance to keep the current flowing when it's cut off, that would be different. The response time of the IR Receiver is very quick. This needs to be looked at some more.
I was doing some research on the web, there seems to be a whole webpage about IR object detection - about halfway down there's a section on PWM. I'm not sure if it's talking about the IR led or something else, I haven't read it yet.

You could add a jumper, like those used on disk drives. Pins spaced 0.1" apart. Cheaper and smaller than a switch.
That's genius! I might have to make one or buy a specially made one, though, because I'm not sure how far apart the pins on the header are.

Here's the newest version of the WallBot schematic (Hopefully the picture works this time)

EDIT: Pin 5 on the header is supposed to go to RESET, so I figured I could just connect it to VCC.

 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
re: V+ on /RESET pin
I changed it to another VCC symbol, should be correct now.
OK, the symbol is correct - but R3 has a wire running through it! This means that the /RESET pin is shorted to VCC. That simply won't do.

Check out the schematic below, I used a piece that looks similar to a header connector and wired it up according to this website.
OK. Haven't looked at the website yet.

re: header/jumper
That's genius! I might have to make one or buy a specially made one, though, because I'm not sure how far apart the pins on the header are.
It's not genius - it's a very common thing ;) You have to be careful when specifying headers that you get the right pin spacing. There are 2MM headers and 1MM headers in addition to 0.1" (2.54mm) headers. The pin spacing is naturally all different. 0.1" headers are the most common in the US. You can even get 0.1" headers and jumpers at Radio Shack.
Look in pinhead.lbr or pinhead-1.lbr.

EDIT: Pin 5 on the header is supposed to go to RESET, so I figured I could just connect it to VCC.
Nooooo! :eek: Unless you like to see smoke pouring out of your brand-new programmer. :rolleyes:

You need to connect pin 5 of the ISP header directly to the /RESET pin. There must be 10k of resistance between the RESET pin and Vcc. That's supposed to be provided by R3, which you currently have shorted out by a wire running through it.

Did you use the ISP header from the atmel.lbr or atmel-1.lbr? I suggest you use AVR-ISP-6 for now, unless someone more knowledgeable about Atmel AVR's comes along and suggests otherwise.

As for the VALUE field; you have "10kohm" specified for R3. Really, "10k" is all that's necessary. "Ohms" is implied by the fact that the symbol is a resistor. It would be a really bad idea to attempt to abbreviate it to "O", because then 10 Ohms could look like 10O.

When you get around to using resistors in the megohm range, a 9,100,000 Ohm resistor should be coded as 9.1MEG - not 9.1M. It's too easily confused with 9.1m, which is 9.1 milliohms, or 0.0091 Ohms. When you start using SPICE simulations, you MUST use MEG, or the simulation will think you meant milliohms.
 
Last edited:

Thread Starter

Qaptian

Joined Oct 27, 2008
37
re: V+ on /RESET pin

OK, the symbol is correct - but R3 has a wire running through it! This means that the /RESET pin is shorted to VCC. That simply won't do.
Fixed that, also added a diode to VCC on the reset pin because I don't want electricity going the wrong way while I'm programming. Was that a good choice, or no? Perhaps I can use a resistor between pins 5 and 2 instead of connecting pin 5 to the reset pin on the micro?

Here's an updated image:



How do I connect all the VCC's together when the time comes to construct this beast? I see them all there, but I'm not sure where to connect them. Will I just solder the ones on the lower part of the schematic together, then solder that bunch to the main VCC coming out of the regulator?
 

SgtWookie

Joined Jul 17, 2007
22,230
Fixed that, also added a diode to VCC on the reset pin because I don't want electricity going the wrong way while I'm programming. Was that a good choice, or no? Perhaps I can use a resistor between pins 5 and 2 instead of connecting pin 5 to the reset pin on the micro?
You didn't fix it completely, because you now have the ISP RESET connected to the wrong side of R3. As I've said twice previously, it needs to be connected to the reset pin.

Also, you've run the RESET line right across the junction of R1 and D9. If you perform an error check (lowest symbol on the toolbar, or on the menu, Tools -> Erc) you'll get a report of all the "gripes" that Eagle has with your schematic. Best to use it frequently, because errors accumulate rapidly and it makes it a mess to fix later. I ran the RESET line below the Atmel, and around the left side. Better than mucking up the right side.

How do I connect all the VCC's together when the time comes to construct this beast? I see them all there, but I'm not sure where to connect them. Will I just solder the ones on the lower part of the schematic together, then solder that bunch to the main VCC coming out of the regulator?
You haven't even started with a PCB layout yet.

That'll be figuring out what's a good placement for all the parts, and then routing traces everywhere they need to go. The free demo version has autorouting for two layers (top & bottom), for boards up to 3"x4" (approximately). But, autorouting can create problems if you have mixed signals (analog and digital).

Eagle has a "copper pour" feature. Basically, it's the polygon tool. You can make a single rectangular polygon around the edge of the board, the use the Name tool to change it's signal name to VCC (for the top) or GND (for the bottom), and the "Ratsnest" command will cause the polygons to fill. But, this is getting ahead of things, and you're confused enough already.
 

Thread Starter

Qaptian

Joined Oct 27, 2008
37
You didn't fix it completely, because you now have the ISP RESET connected to the wrong side of R3. As I've said twice previously, it needs to be connected to the reset pin.
I was thinking that if I connected it to the left side of R3, I wouldn't need another resistor. Do I need a resistor when I'm going from pin5 of the header to RESET?

Also, you've run the RESET line right across the junction of R1 and D9. If you perform an error check (lowest symbol on the toolbar, or on the menu, Tools -> Erc) you'll get a report of all the "gripes" that Eagle has with your schematic. Best to use it frequently, because errors accumulate rapidly and it makes it a mess to fix later. I ran the RESET line below the Atmel, and around the left side. Better than mucking up the right side.
OK, I clicked the yellow "!" and I got a list of about 8 errors. I tried fixing the ones I understood, but they still show up in the error checker. Does that mean I didn't fix the problem?


You haven't even started with a PCB layout yet.
I'm WAY in over my head as it is. Trying to create a circuit with absolutely zero prior knowledge about how they should work is not easy. I'm going to wait on the PCB until I get the circuit 100% complete.

Thank you so much for helping me out, SgtWookie. It's truly appreciated.
 

SgtWookie

Joined Jul 17, 2007
22,230
I was thinking that if I connected it to the left side of R3, I wouldn't need another resistor. Do I need a resistor when I'm going from pin5 of the header to RESET?
No. R3 will take care of the pull-up detail during normal operation. But there needs to be a connection straight from ISP pin 5 to the Atmel pin 1. During programming, the programmer may pull the Atmel pin 1 to ground or to above Vcc; I don't know offhand. PICs get their pin 1 pulled to somewhere between 10v and 13v, depending upon the particular uC. The Atmel is probably something similar.

OK, I clicked the yellow "!" and I got a list of about 8 errors. I tried fixing the ones I understood, but they still show up in the error checker. Does that mean I didn't fix the problem?
Did you click the yellow "!" again? You will get a new list of "problem children" every time you click the yellow "!". It gets even more fun when you're creating a PCB layout. You may sometimes feel like a little mouse lost deep in a hole somewhere without any cheese.

I'm WAY in over my head as it is. Trying to create a circuit with absolutely zero prior knowledge about how they should work is not easy. I'm going to wait on the PCB until I get the circuit 100% complete.
That's not a bad idea. Taking things slowly and carefully will result in more progress than doing things in a willy-nilly haphazard fashion, and then having tons of clean-up later.

Did you go through that Eagle tutorial over on Sparkfun? It's really quite good, and if you take your time to understand it, you'll learn a number of useful things.
 

Thread Starter

Qaptian

Joined Oct 27, 2008
37
Did you click the yellow "!" again? You will get a new list of "problem children" every time you click the yellow "!". It gets even more fun when you're creating a PCB layout. You may sometimes feel like a little mouse lost deep in a hole somewhere without any cheese.
That made a few of them go away, but others still remain that I hope won't affect anything.

I've got these errors:
Unconnected INPUT pin IC2 SEN_A
Unconnected INPUT pin IC2 SEN_B

I don't think those matter because they are optional pins on the L298 - at least I've understood them that way.

Then I've got these warnings:
POWER pin IC2 VS connected to V+
I don't think this matters, because it makes sense to connect it this way.

POWER pin IR1 VS connected to N$17
Also shouldn't matter, that's just how it connects (I believe N$17 is VCC - or it's an error).

Part S1 has no value
Should not be a problem because S1 is only a switch (even when I give it a value, it still warns me.)

Did you go through that Eagle tutorial over on Sparkfun? It's really quite good, and if you take your time to understand it, you'll learn a number of useful things.
I actually couldn't find it at first - there was a link earlier to a tutorial on sparkfun, but it was some sort of beginners electronics guide. I read that, then tonight I went back to their site and now I'm checking out their eagle tutorial (http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=108). It looks quite expansive, which will help me out - I really don't know anything about eagle. I'll put the finishing touches on this schematic and post it - hopefully then I can start learning about PCBs
 

SgtWookie

Joined Jul 17, 2007
22,230
That made a few of them go away, but others still remain that I hope won't affect anything.

I've got these errors:
Unconnected INPUT pin IC2 SEN_A
Unconnected INPUT pin IC2 SEN_B

I don't think those matter because they are optional pins on the L298 - at least I've understood them that way.
They aren't optional! If they aren't connected, there will be no path to ground for your motors.

Normally, that is where you'd connect "sense" resistors for determining the amount of current flowing through the motors. However, you're not going to use them for this project - so you can simply connect them to ground.

Then I've got these warnings:
POWER pin IC2 VS connected to V+
I don't think this matters, because it makes sense to connect it this way.
That's fine. There isn't a VS symbol in the library anyway - or I might've used it.

POWER pin IR1 VS connected to N$17
Also shouldn't matter, that's just how it connects (I believe N$17 is VCC - or it's an error).
N$17 is the signal name of the wire that goes from the pin to the resistor. It's OK.

Part S1 has no value
Should not be a problem because S1 is only a switch (even when I give it a value, it still warns me.)
Interesting - that's a new feature in version 5. 4.16 doesn't care if there is no value. Usually, you put the part number in there. It shows up when you generate a BOM list.

re:sparkfun tutorial
I actually couldn't find it at first - there was a link earlier to a tutorial on sparkfun, but it was some sort of beginners electronics guide. I read that, then tonight I went back to their site and now I'm checking out their eagle tutorial (http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=108). It looks quite expansive, which will help me out - I really don't know anything about eagle. I'll put the finishing touches on this schematic and post it - hopefully then I can start learning about PCBs
Yes, that was it. But, I wanted you to go through the entire process, since practically all of it applies directly to this project that you're attempting now. And it will save ME a heck of a lot of typing!

I don't mind helping people. At the same time, there are a lot of other folks on this board that need help - and I only have so much time to spend here.

If you just go through that whole project from start to finish, and draw along in Eagle, you'll rapidly get a LOT more proficient in it, you'll learn a number of new things, and questions will be answered that you haven't even thought of yet, along with avoiding several nasty pitfalls, like failing to keep the board layout open when you make changes to the schematic - that can be a real nightmare to fix! :eek:
 

Thread Starter

Qaptian

Joined Oct 27, 2008
37
OK, I think I'm finally done with the schematic. I tried something new I learned from the tutorial - labeling wires so I don't have to have them connect (can be seen on PIN5 of the header going to the RESET pin on the micro)

Adding GND symbols to the SEN_A and SEN_B pins gave me some consistency errors:

Different connections on IC2 pin SEN_A and pad 1 (GND/none)
Different connections on IC2 pin SEN_B and pad 1 (GND/none)

I'll ignore those for now, they look fine in eagle, and I'm pretty sure I connected them properly.

I followed the PCB layout tutorial for eagle on sparkfun - it worked, but I don't think the PCB autorouted correctly. Some traces go from the top of the board to the bottom, without any holes in it. I ended up not saving this file because it didn't look right.

It was really neat to watch the autorouter in action, though!

Here's what I assume should be the final schematic for this project! How exciting!
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
OK, I think I'm finally done with the schematic. I tried something new I learned from the tutorial - labeling wires so I don't have to have them connect (can be seen on PIN5 of the header going to the RESET pin on the micro)
I can't view schematics or boards that were created with versions of Eagle past 4.16. Mine is registered, and I don't want to invest more money on upgrading it. Post it in .PNG format.

Adding GND symbols to the SEN_A and SEN_B pins gave me some consistency errors:

Different connections on IC2 pin SEN_A and pad 1 (GND/none)
Different connections on IC2 pin SEN_B and pad 1 (GND/none)

I'll ignore those for now, they look fine in eagle, and I'm pretty sure I connected them properly.
I don't know how you connected them, but delete the wiring and connector to both of those pins, and use the GND symbol from the supply2 library. Otherwise, you will have an inconsistency that will cause problems when you try to create a board.

I followed the PCB layout tutorial for eagle on sparkfun - it worked, but I don't think the PCB autorouted correctly. Some traces go from the top of the board to the bottom, without any holes in it. I ended up not saving this file because it didn't look right.
Interesting. Did you do an error check and fix any errors before you created a board?
Did you do a Design Rule Check before you tried autorouting it?

It was really neat to watch the autorouter in action, though!
Yep, it's pretty neat. I don't have the autorouter module, it was an extra $400 or so. Autorouting can cause big problems, particularly if you have mixed signals (analog/digital) in a circuit. You CAN set up "rules" for autorouting, but unless you're doing production-type work with a LOT of very similar circuits, it's not worth the time.

Here's what I assume should be the final schematic for this project! How exciting!
Like I say, I can't examine it. Maybe I'll load up a demo Eagle on another computer, but not right away. Don't have the space to set it up.

There's still issues with the IR receiver. I don't know which exact model you have, but that type of receiver will only respond to an IR signal at a specific frequency, somewhere in the range of 30kHz to 40kHz. You will have to compare your exact part number to the datasheet's table.

Your IR receiver has AGC, which is Automatic Gain Control. That means if the IR emitter LED is bouncing/reflecting enough light from something for it to see, you'll get a 1 output from it; if not, you'll get a 0. In order to be able to get some vague idea on how far away you are from an object (let's say, a white wall) then you will have to be able to vary the intensity of the LED - while it is being turned on and off at the frequency the receiver is "tuned" to.

Also, the IR LED is rated for up to 100mA current. I'm not sure offhand, but I think that the Atmel uC can probably only output around 20 to 25mA. While you possibly won't want that much power output, if you don't plan for it, you're not going to be able to get there without modifications to the board. Best to plan ahead!
 

Thread Starter

Qaptian

Joined Oct 27, 2008
37
Here's a picture for you:
http://img507.imageshack.us/my.php?image=circuit9kv1.png

I don't know how you connected them, but delete the wiring and connector to both of those pins, and use the GND symbol from the supply2 library. Otherwise, you will have an inconsistency that will cause problems when you try to create a board.
Yep, that did the trick - those errors are gone now.

Interesting. Did you do an error check and fix any errors before you created a board?
Did you do a Design Rule Check before you tried autorouting it?
I think that might have just been a fluke, or I wasn't reading it correctly. I made another PCB and it looks pretty good this time. Here's a few pictures of it:

Full PCB w/ parts
http://img84.imageshack.us/my.php?image=pcbfullcy7.png

Top of PCB
http://img84.imageshack.us/my.php?image=pcbtopqx0.png

Bottom of PCB
http://img368.imageshack.us/my.php?image=pcbbottomqy9.png



There's still issues with the IR receiver. I don't know which exact model you have, but that type of receiver will only respond to an IR signal at a specific frequency, somewhere in the range of 30kHz to 40kHz. You will have to compare your exact part number to the datasheet's table.
I'm purchasing a part from the TSOP21x series, the TSOP2138. According to the data sheet, I'm going to get one that responds to a 38kHz signal. I added a custom piece to the schematic instead of the one that was on there earlier.

Your IR receiver has AGC, which is Automatic Gain Control. That means if the IR emitter LED is bouncing/reflecting enough light from something for it to see, you'll get a 1 output from it; if not, you'll get a 0. In order to be able to get some vague idea on how far away you are from an object (let's say, a white wall) then you will have to be able to vary the intensity of the LED - while it is being turned on and off at the frequency the receiver is "tuned" to.
I can do this using resistors, or possibly PWM, right? I've got a few resistors and LEDs at home right now, I can tool with them and see how the intensity is affected to get a general idea for what type of resistors I'll need.

Also, the IR LED is rated for up to 100mA current. I'm not sure offhand, but I think that the Atmel uC can probably only output around 20 to 25mA. While you possibly won't want that much power output, if you don't plan for it, you're not going to be able to get there without modifications to the board. Best to plan ahead!
I probably won't need this much current. As long as the LED is able to run at a lower current and I can get a few different intensities using resistors or PWM, this shouldn't be a problem. I will need to change the resistor that's there currently though - I calculated it thinking 100mA would flow through it.
 

SgtWookie

Joined Jul 17, 2007
22,230
OK, I suggest that you need a separate circuit to provide the 38kHz modulation, perhaps provided by a 555 timer. Otherwise, you'll have to switch the LED on and off using uC programming - and your plate is already rather full. You don't want to have to deal with this kind of precise timing via programming, because you will quickly become lost.

What you need to do now is to design an astable (free-running) 555 timer circuit that will provide the 38kHz base frequency that the receiver will recognize. If you don't, you'll have to code all of that stuff. Not something you want to do as a "newbie".

There are lots of pitfalls about this project already. Trying to make progress is good. However, you need to take a look at where you were a week ago, where you are now, and where you're headed.

You can make up for SOME shortcomings via software. However, you will not be able to compensate for GLARING shortcomings via software. The uC simply doesn't have the processing power.

Offloading the task of keeping the IR LED output within the band of the IR receiver only makes good sense.

I'm going to hand that task off to you for now. Research how to make an oscillator to drive the LED at a frequency close to what is needed.
 

Thread Starter

Qaptian

Joined Oct 27, 2008
37
I'm going to hand that task off to you for now. Research how to make an oscillator to drive the LED at a frequency close to what is needed.
After a bit of reading, and some calculations, I've made an astable circuit that should run the LED at about 38kHz (37774.906885 Hz to be exact - I hope it's close enough to work). I followed the diagram in the tutorial, with some help from this datasheet, and I calculated the resistors to be 220 ohms and 1800 ohms (couldn't find a 1.8kohm resistor, so I put a 1kohm, 470ohm, and 330 ohm in series) while using a .01uF capacitor between Pin6 and GND. I placed the 555 in the top right corner of the schematic:

 

SgtWookie

Joined Jul 17, 2007
22,230
OK, you've researched the LM555 timer, but in the schematic you used an ICM7555 timer. I suggest that you replace the symbol in your schematic with a 555 timer symbol; as the ICM7555 is a CMOS version that does not have the source/sink capability of a bjt 555. Alternatively, you could change the VALUE field to denote an LM555N.
(Generally, "N" suffixed parts in Eagle mean a DIP package.)

As far as the PIN4 wire naming - that's not so good! Error check will complain vociferously about that. Right now, you have renamed VCC to PIN4, and everywhere in the circuit will have a conflict due to that naming.

Delete both of your PIN4 wire namings. Use a VCC symbol from supply2.lbr to connect pin 4 to VCC.

Let's work on the RC values for the timer circuit. When you start seeing very low values of resistance, it's time to decrease the value of the timing capacitor; in your case C6.
Decrease C6 to 1nF. Change R8 to 1.5k. Change R1 to 10k. Replace R4 and R7 with a single 10k, 10-turn trim pot, set to an initial value of 8.22k. That will give a duty cycle of about 52% on, 48% off.

If it doesn't oscillate with those values, then R8 should be changed to 3k, and the pot set to an initial value of 7.5k. That changes the duty cycle slightly from 54% on to 46% off.

As far as 555 simulations/calculations vs reality - your mileage will vary, perhaps considerably! This is where "breadboarding" comes in very handy.
 
Last edited:

Thread Starter

Qaptian

Joined Oct 27, 2008
37
OK, you've researched the LM555 timer, but in the schematic you used an ICM7555 timer. I suggest that you replace the symbol in your schematic with a 555 timer symbol; as the ICM7555 is a CMOS version that does not have the source/sink capability of a bjt 555. Alternatively, you could change the VALUE field to denote an LM555N.
(Generally, "N" suffixed parts in Eagle mean a DIP package.)
Changed that, now the 555 is named LM555N.

As far as the PIN4 wire naming - that's not so good! Error check will complain vociferously about that. Right now, you have renamed VCC to PIN4, and everywhere in the circuit will have a conflict due to that naming.
Delete both of your PIN4 wire namings. Use a VCC symbol from supply2.lbr to connect pin 4 to VCC.
I fixed this, too. There was an error in eagle, but since I've connected it the way I have below, the error has gone away.

Let's work on the RC values for the timer circuit. When you start seeing very low values of resistance, it's time to decrease the value of the timing capacitor; in your case C6.
Decrease C6 to 1nF. Change R8 to 1.5k. Change R1 to 10k. Replace R4 and R7 with a single 10k, 10-turn trim pot, set to an initial value of 8.22k. That will give a duty cycle of about 52% on, 48% off.
OK, I also changed the values for the resistors and added a trim pot resistor, I wasn't sure how to connect it, so I just connected pins 1 and 3 like a normal resistor, then pin 2 to ground.

Can I use a multimeter to measure the resistance of the trimpot when I actually use it? I couldn't find the data sheet for the one I plan on buying

As far as 555 simulations/calculations vs reality - your mileage will vary, perhaps considerably! This is where "breadboarding" comes in very handy.
Speaking of simulations, I found a fun little one that lets you put in values and simulate a 555 circuit! Heres the link: http://www.delabs-circuits.com/cirdir/theory/gates/doc00019.html

I think we're close to being done - I'm gonna start work on finding all the parts I'll need. I'm sure there will be kinks to work out during the testing phase, so this is definitely not a final schematic.

Here's the latest version of WallBot:

 

SgtWookie

Joined Jul 17, 2007
22,230
Changed that, now the 555 is named LM555N.
OK, I also changed the values for the resistors and added a trim pot resistor, I wasn't sure how to connect it, so I just connected pins 1 and 3 like a normal resistor, then pin 2 to ground.
Oops. Nope! Pin 2 is the "wiper" of the pot, 1 and 3 are either end of the pot. Delete the ground on pin 2, and connect pin 2 to either pin 1 or pin 3. Used that way, a pot becomes a rheostat, which is what you need.

Can I use a multimeter to measure the resistance of the trimpot when I actually use it? I couldn't find the data sheet for the one I plan on buying
Yes.
You want a linear pot, not an audio or log taper pot.

Speaking of simulations, I found a fun little one that lets you put in values and simulate a 555 circuit!
Interesting, but it doesn't allow you to enter fractional values.
Try downloading 555 Timer Pro. You can run it as freeware in the "lite" mode.
http://www.schematica.com/555_Timer_design/555_Timer_PRO.htm

I think we're close to being done - I'm gonna start work on finding all the parts I'll need. I'm sure there will be kinks to work out during the testing phase, so this is definitely not a final schematic.
Still need to work out the IR LED details.

While the 555 timer circuit will pretty much take care of the 38kHz drive, you'll still need a way to vary the intensity of the IR radiation.

This could be done with 3 resistors and two small-signal MOSFETs like 2N7000's. The three resistors in parallel should allow the maximum current that will be going through the LED. The largest value resistor won't be switched; it'll be connected to ground. That will provide a default low intensity setting. The other two can be switched in and out by the uC to provide a total of 4 distinct lighting levels. This will give your 'bot the ability to get an idea of the distance it is from an object.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
OK, see the attached.

I took a look at the datasheet for the IR LED, and decided to go with the 1.3v @ 50mA specification.

In the attached schematic, the 2N7002 should be a 2N7000 MOSFET. These are handy little switching MOSFETs that can sink up to 200mA, and work fine when driven by 5v CMOS. Don't worry about the part number of the LED in the attached; it was just an LED that was in my library.

U1's gate is driven by the output of the 555. Because a 555's output on the high side is about 1.2v below the supply voltage, you'll need to power the 555 by V+ instead of Vcc; 3.8v really isn't enough to turn on the 2N7000 fully.

The 555 is also going to need a 220uF bypass cap between it's pin 8 (V+) and GND. It would be a good idea to have a 1N4004 diode between V+ and the cap to prevent the motors from draining the 220uF cap.

When all three MOSFETs are turned on, the total resistance is roughly 77 Ohms, which gives about 48mA current through the LED.
With U1 and U3 on, U2 off, resistance is about 108 Ohms for 34.3mA, 71% brightness.
With U1 and U2 on, U3 off, resistance is about 180 Ohms for 20.6mA, 43% brightness.
With U1 on, U2 and U3 off, resistance is about 540 Ohms for 6.8mA, 14% brightness.

[eta]
The 2nd schematic is very similar, but using slightly different resistance values.
With U1 and U3 on, U2 off, resistance is about 103 Ohms for 35.9mA, 72% brightness.
With U1 and U2 on, U3 off, resistance is about 148.5 Ohms for 24.9mA, 50% brightness.
With U1 on, U2 and U3 off, resistance is about 330 Ohms for 11.2mA, 23% brightness.
 

Attachments

Last edited:

Thread Starter

Qaptian

Joined Oct 27, 2008
37
The 555 is also going to need a 220uF bypass cap between it's pin 8 (V+) and GND. It would be a good idea to have a 1N4004 diode between V+ and the cap to prevent the motors from draining the 220uF cap.
I added this, but why a 220uF capacitor? How did you know to use this one? I'm sure it's got something to do with lots of experience - but I'm a noob.


I also made an attempt to put together schematic #2 in eagle. I added everything on after the LED. I don't see how this works, though - how is the LED affected by components added on after it? I'm super tired right now, I'm probably not looking at this the right way.

I added an LED on to a pin of the micro, I'd like to try PWM on another LED after I get this bot running.

Now I'm thinking this is wired wrong - the resistors should be on the micro, so I can change LED intensity by flipping an internal switch, correct? I'm going to do this again tomorrow, it doesn't look right.

Also, which pins are gate, drain, and source in the diagrams you posted? This will help me get a clearer idea of how to put the 555 circuit together.



I'm sincerely grateful for all the assistance you're providing me, SgtWookie - it takes a really talented person to help out a noob with something so complex as this (maybe not complex to you...).
 
Top