Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic 10f200 bicycle lights, power on reset issues.

Status
Not open for further replies.

dr pepper

Well-Known Member
Most Helpful Member
I'm prototyping a set of cycle lights where power comes from a dynamo to flash a 10w power led up front and in the rear.
The pic reads the freq from the dynamo so it can tell when its not going fast enough to light the 10w leds, and flashes 5mm leds instead from a pair of aa's, a 'stand light'.

The software so far works well, and switches from 10w leds to 5mm leds no problem, however I'm getting trouble with the 10f200 locking up and crashing at the point where the dynamo voltage goes above the battery voltage and the dynamo powers everything.
I have the usual decoupling caps and a smoothing cap on the o/p of the dynamo rectifier.
Seems like the pic doesnt like a slow rising vdd.

Is there a way I can get the chip to boot reliably without using the mclr pin?, the 10f200 doesnt have a brown out option, at the moment the pic is powered by the aa's only, thats not so good as when they go dead the whole system wont work.
 
OK so your gonna ask for schem, heres a naff hand drawn one.
The rs 232 is used to tell the micro which led to flash and to sync the front and rear, the dynamo isnt powerfull enough to flash both at once, and they do not have current limit resistors and run at diffo voltages.

light.gif
 
I think changing to a PIC that has brownout handling would be a good idea!

Re your circuit, if you change from the LM7805 5v regulator to a low-dropout type, your system will reach 5v whenever the input is greater than 5.1v. At the moment with the 7805 it only reached 5v when the dynamo is making more than about 7.8v! I bet that difference between 5.1v to 7.8v is right in the critical pedaling zone too where you have to start pedalling significantly harder to get 7.8v... ;)

Or alternatively, power the PIC from the two AA cells but make them rechargeable, and change the circuit so the dynamo keeps the battery charged. You can even get the PIC to handle recharging or at least part of the process. Again, going to a better featured 8-pin PIC like a 12F675 or 12F684 (Ithink?) will allow better performance especially if you want some battery charging handling.
 
A low dropout reg good idea, the dynamo produces 9v at walking speed but still a low dropout reg might be better, or for the amount of juice the pic pulls maybe a shunt reg with a zener and resistor, the leds are buffered with a tranny.

I didnt want to use rechargeables as I wanted every ma for the leds, I thought of charging the battery while the lights are off, but in this country and the hours I work it'll be riding in darkness every trip.
Do you think I could charge nimh's with a pulse, ie flash fron led, flash rear led, charge battery, that way I could time share what energy I have from the dynamo hub.

I'll change the init section for the 10f200 and try a 16f628 with brownout enabled, I dont want to use the '628 but I have a load to hand if it works then a 12f675 or I think your right rb the '683 is a '675 without the a/d.
 
You mean on the '628, yes I could read td and pu bits.

Since the last post I had a rethink combined with you peoples comments, why do I need the 'f200 powered by dynamo and batteries, and why does the 'f200 in the rear light need to switch the 10w rear light with a fet?, it doesnt.

With some minor code mods I now have a 2 x aa led flasher using the 'f200, and theres a simple level shifter tranny from the 10w red led to the pic, when the dynamo powered rear 10w led flashes the 'f200 shuts down flashing the smaller stand still leds, I just had to add a delay so that the pic doesnt start flashing the stand light leds inbetween 10w red led flashes, the the 'f200 is only powered by batteries, which if flat dont stop the dynamo working.

No reset issues, no 78l05, no fet, no serial and single core cable from the front.

Now on with the front light pic controller, I'll use a device that has brownout detection, and I'm resisting the temptation of an lcd.
 
...
I didnt want to use rechargeables as I wanted every ma for the leds, I thought of charging the battery while the lights are off, but in this country and the hours I work it'll be riding in darkness every trip.
...

I think the battery offers a lot of benefits. It could offer a smaller light level when the bike is stopped or at very low speed. That's better than the light just going off if you have to stop of slow right down.

In general re the micro the battery would not draw much more than the micro when in a steady state as it only has to top up the amount the micro consumes.

...
Do you think I could charge nimh's with a pulse, ie flash fron led, flash rear led, charge battery, that way I could time share what energy I have from the dynamo hub.
...

That's a great idea! Energy sharing depending on tasks is a nice sophisticated feature that is easy to add with a micro. :)

...
I'll change the init section for the 10f200 and try a 16f628 with brownout enabled, I dont want to use the '628 but I have a load to hand if it works then a 12f675 or I think your right rb the '683 is a '675 without the a/d.

A 16F628 has no ADC, I would go for one of the cheap PICs with ADC like a 12F675 or 12F682/684? which is the new 8pin ADC device to replace the 675.
 
A 16F628 has no ADC, I would go for one of the cheap PICs with ADC like a 12F675 or 12F682/684? which is the new 8pin ADC device to replace the 675.

Look at the 12F1822, ADC, Fixed voltage reference, EUSART all in 8 pin package. Its a new enhanced midrange part, if you like a replacement for the 12F683 + extra features
 
Only the newest compilers/assemblers/programmers support that PIC. And being a new chip there are a lot less of them in hobby junkboxes. :)

I prefer to suggest PICs with a multi-year history of being popular.
 
So the '682/684 are replaceements for the '675, didnt know it was out of date allready, are they code compatible?

I have the software working well now, there is no power switch on the design, the dynamo powering the rear light brings the pic out of sleep, upon which it goes back to sleep untill the dynamo light goes out then the pic flashes the smaller leds for a couple of minutes then sleeps, no need for a power switch fully automatic.

If I go for nimh's then I'd have to have an a to d as only having 2 wires to the rear light the only way I'd know when to pulse the nim's is when the voltage increases to higher than that when either light is on which is about 12v.

Testing the rear light was interesting, I think I'll be seen with 400 lumens off the back of my pushhog, and the front goes a long way with a corridor lens, it dissipates 6w and they say leds give 10 times light than a incandescent so its as bright as a 60w would be, as good as a car headlight.
 
Only the newest compilers/assemblers/programmers support that PIC. And being a new chip there are a lot less of them in hobby junkboxes. :)

I prefer to suggest PICs with a multi-year history of being popular.

If we just keept using what's in the junkbox we'd all still be using a 16F84A. :)

It's true that there are a lot of 12F629/675/683 about so if your goal is to make the application available to lots of hobbyist around the world these parts might be prefered and there is a large base of existing code if you just want to use that.

The enhanced 12F1xxx/16F1xxx devices have been around for a few years now, the PICkit2 supports a lot of these new parts, as has MPLAB for the last few years. MikroC Pro, CCS, BoostC have all had support for a while as have the Microchip compilers.

I've been using the enhanced parts for 2/3 years now and you get more features for less money, for example a 12F683 from RS is GBP1.18, 12F1822 is GBP0.94. In fact the price of the older parts is going up while these newer parts are coming down.

I now have an enhanced junkbox :)
 
I think I'd better update my junkbox then, I have a load of old stuff.
I still use the 'f54 and that part is very cheap.

Incidently I thoght I'd do a little work to see if the 'f200 would work on my system before giving up and going to another chip with brown out protection, and I did get it to work well, the 78l05 seems to be the issue, not sure whats going on exactly but I replaced the reg with a 1k/4v7 zener and a 100u cap and it works great.
The hub dynamo appears as a current source maye theres a wierd oscilation thing going on, cant be bothered holding the front wheel up spinning it and looking at the 'scope any longer.
 
So the '682/684 are replaceements for the '675, didnt know it was out of date allready, are they code compatible?
...

Sorry about the part number it's the 12F683 (as others have said), pin compatible with the 12F675 but with twice the ROM and has both ADC and comparator, 3 timers and capture module (PWM etc). Yep it's code compatible, but of course with additional hardware modules and features you may have to add a couple lines of code if those modules need to be initialised or take control of port pins etc.

I have the software working well now, ...
...
Testing the rear light was interesting, I think I'll be seen with 400 lumens off the back of my pushhog, and the front goes a long way with a corridor lens, it dissipates 6w and they say leds give 10 times light than a incandescent so its as bright as a 60w would be, as good as a car headlight.

Congrats on the working result. :)

That sounds pretty cool, I only ever remember bicycle headlights as really dim and weak, so something that performs like a 60W sealed beam headlight would be very impressive and fun to ride at night. Where's the photos? :)


Geko said:
...
The enhanced 12F1xxx/16F1xxx devices have been around for a few years now, the PICkit2 supports a lot of these new parts, as has MPLAB for the last few years. MikroC Pro, CCS, BoostC have all had support for a while as have the Microchip compilers.

Yeah, you're right of course. I tend to be slow to takeup new PICs, I have many sticks remaining of the PICs I have used and ordered over the years and there's not a lot of incentive to embrace a new PIC when I have so much working code (and free PICs) in arms reach from the older PICs.

Geko said:
...
I've been using the enhanced parts for 2/3 years now and you get more features for less money, for example a 12F683 from RS is GBP1.18, 12F1822 is GBP0.94. In fact the price of the older parts is going up while these newer parts are coming down.

They are a really nice value for the price PIC, that's for sure! I went for 18F series instead of the enhanced 16F, and have stocks of those, so again for me there's no real incentive to get enhanced 16F parts.

Geko said:
...
I now have an enhanced junkbox

:D
 
I didnt take any pics so far I've tested the led with its lens but I had to hold it all together and spin the bike wheel, no hands left to take pics, and mi camera is pants, I'll see if I can get a couple of shots, maybe a vid when I get a little further, it does however make the 2.4w front lamp I had as a kid look pathetic, the only thing I found is that the lens projects multiple blocks of 9 dots (the leds on the die).

I'm gonna download and take a look at the datasheets for the new pics, my supplier does stock them, its difficult to know without being in the biz which is the latest favorite.

When I started this project I had an old dynohub (from my childhood), the magnets field strength has like my eyesight gone, however I found a couple of sites where they use these as wind power generators and a couple of guys have re-magneted them with neo magnets heres a pic, one thing I never understood is sturmey the manufac say that as soon as you pull the magnet from the housing it loses its magnetism and doesnt come back, didnt know alnico did that, but neo's wont, the o/p goes up by 3 times with this mod.

IMG_5212.JPG
 
Status
Not open for further replies.

Latest threads

Back
Top