urgent!!! help with picaxe 08M

parisien

Member
hey guys plz help me

tell me hw do we use the ADC1 / ADC2 in a picaxe 08M? wat are we using for ??im building an MPPT but got some problems, coz i have to regulate the output in such a way i always...

I stil got another problem. iset my pwmout at a freq of 20Kh, 80% duty. i need to use this signal to switch my transistor in the boost converter. the problem is now, b4 i connected my picaxe to the circuit, i got the squarre wave that i want , with the magnitude and duty cycle, everything perfect. then now when i connect the pin5 to the base of my transistor, i got a funny wave signal, and the magnitude of the waveform drops so much like close to 0.8V.

Dt know wat the problem is !!! can u plzzz guys help me out with this, is someone understand the problem


plzzz help me out, its so urgent.
tanx.
 

ylp88

Senior Member
Writing clearly and thinking about what you want to say before you type it helps us to give you better responses. Nice punctuation and capitalisation always is nice as well.

With regard to ADC, have you looked in in the manual regarding the use of the READADC (or READADC10) command?

As for your square wave, have you got a suitably sized resistor between the PICAXE digital output pin and the base of the transistor? Otherwise the base-emitter junction acts like a diode and clamps the output voltage of the PICAXE to around 0.6-0.7V (i.e. a diode drop, it is a PN junction after all!)

ylp88
 

BeanieBots

Moderator
Sit back, breath and think about what you are doing.
Maybe you should start with something a little more simple!

If you don't know about how to drive a single transistor from a PICAXE output, you are really going to struggle with a MPPT controller. As stated above, the 0.8v is because you don't have a suitable base resistor. By the way, your current circuit could (and may already have) destroy the PICAXE:eek:

As for using the analogue inputs, it is all clearly explained in the manual. If you have a more specific question, then think it out and ask away.
 

parisien

Member
sorry for the writing

hi yy88

sorry for the writing and tanx for ur remarks.

in fact, im building an MPPT using cells as input, so i have to regulate the output in such a way i always get 12V/2A or 20W output. so im using a picaxe 08M, dt know really know how to do the regulation, etc.....

tanx 4ur help

im online right now, can we maybe meet on msn messenger or yahoo??

letmeknow.
 

westaust55

Moderator
Can I suggest that you post your schematic (wiring) diagram and your existing program so we can get a better idea where and how to guide you.

Additionally, try keep to plain (your best) english without slang.

I suggest that you also have a read of the PICAXE manula section3 as follows:

Page 27 about using a potentiometer.
If you are using a 12 V signal you need to scale this down with resisitors as a potential divider or use a potentiometer as the PICAXE analog (ADC) inputs can accept a maximum voltage of 5Vdc.

Look also at page 28, while it is a LDR as the input device it is an analogue device and the program works in the same way.


Then look at page 5 for details on how to interface a standard transistor.
Finally if you are using a FET type transistor have a look at page 7.

When we have some more clear understanding of your circuit and program then others here can better help you.
 

parisien

Member
my schematic

ok westaust55

i have attached my schematic !!! it is a very simple one !! boost converter + Mppt

for my simulation im using for my boost converter, a NPN 2N3055 power transistor. i also used a mosfet IRF530 for some simulation.The diode used here is a schottky .the inductor is a 33uH/5.5A

As mentionned in the sketch, im using for my simulation a resistor 5.6ohm/20W at the output. my goal at the output, is to get 12V/ 2.5A, which is going to give me 30 W. so if i can have anytime an output power of 20-30W ou a little bit more, i will be happy.

secondly i would like to built my mppt. this mppt will help me to always regulate the output power at its max everytime.for that i would like to use a micro chip Picaxe 08M to achieve that. The problem is i am not really use to micro controller, neither programming,etc.... so i dont know where to connect what, etc.....basically dont know how to do the regulation using picaxe 08M.

for the problem of the voltage dropping at the base when i connect my square wave, i tried to put a resistor of 1-10K a the base of the transistor but still doesnt work. ur explanation its regarding this matter its fine. when i tried to put a resistor of 1-10K at the emettor, the voltage at the base was fine (no dropping anymore) but doesnt pump enough current, so dt know....do you have a better solution ??

so i hope that now you guys will understand my problem. hope im more clear and explicite now.

plzz help me guys, count on your help,

PS: my simulation on SWCAD III, give me such good results, i got 12.7V/ 2.35A which gives me something close to 30W. but now when im implementing, it doesnt even boost, and I dont know why !!!!

im really struggling, and its so urgent !!!!

Plzzz help me guys !!!

tanxx
 

Attachments

BeanieBots

Moderator
Oh dear, I don't want to sound rude but you are so way off in ALL respects, it is hard to know how to advise you.
Perhaps your switcher is a good place to start.
If you use a 2N3055 transistor, then the PICAXE is not cabable of driving it directly because its hfe is very low.
If you use the IRF530, then the PICAXE is also incable of driving it directly because of the gate capacitance on a FET.
So, with either transistor type, you will need some sort of driver.

Your input capacitor, the one on the panel, is several orders of magnitude too small. The panel voltage will simply collapse when the transistor comes on. The output capacitor is also too small and will give massive ripple on your output.

So, you don't know about micros, you don't know software and you don't understand switchmode power supplies but you want to build one of the most complex software/electronic projects imaginable:eek:

I really do think you have bitten off more than you can chew!
May I politely suggest that first you get some basic understanding of both electronics and software before you start on this adventure.

Please tell me. How did you come to choose 33uH for the inductor?
What frequency do you intend to run at?
I guess it must be high on account of the input cap value?
Why 4.5 - 5.5v input? Do you know what input current will be required to convert that to 12v @ 30W?
 
Last edited:

Dippy

Moderator
Totally agree with BB. I'm almost as polite as BB but not quite. U've got the wrong idea about transistors of either type. You must look at Hfe , saturation and also about driving MOSFET gates at high frequencies - transistors are NOT perfect on/off switches as you have discovered.

I think this will require someone to design the complete circuit for you. Maybe Westaust??

Plzz don't be offended but I think you'll need to read up a bit more on electronics. People are very happy 2 hlp bt I'm not sure if they'll do the whole job 4 u.

MPPT is an over-used phrase where people really don't understand what is required. Magic words used to impress the ignorant.

So, what supply are you using to give 30W? And I hate to say it, but if it is so urgent and your electronics/coding is so lacking why didn't you start well b4 now?

Thnx, srry but u won't get a solution overnight.
 

ciseco

Senior Member
Dippy I'm in fitz a gigglz, datz gr8

On another note, have just realised you sent me a PM, I've just replied

Miles
________
buy easy vape
 
Last edited:

ylp88

Senior Member
Given your lack of background in electronics, perhaps it would, at the least, be better if you used a chip which was designed for this kind of task, rather than essentially designing one from scratch? There are plenty of switching boost type regulators out there (try National Semiconductor and Dallas-Maxim for a start!) and a schematic might be as easy as copying one from one of their application notes (unless it is urgent because this is a school project, in which case you shouldn't copy!) and changing a few feedback resistors to set your output voltage accordingly.

Aside, I must agree with all the comments above. Start simple. Is there any reason you have such a complex project to undertake?

ylp88
 
Last edited:

moxhamj

New Member
LOL, now, where is Lagos again?

Just a general question, how accurate are these simulators? Do they include gate capacitance on a mosfet or a coil going into saturation? Do you specify the coil core material, or is the model an 'ideal' inductor? Re post #6, I'm just a bit worried that our kindly contributor has been led up the garden path a bit by a simulation that doesn't really reflect real world components...
 
Last edited:

hippy

Ex-Staff (retired)
Welcome to Lagos where your dreams come alive

LOL, now, where is Lagos again?
Number 7 bus, two miles then turn ... No wait. Send me 2,000 AUD and I will arrange personal flight plus hotel accommodation for yourself, family and any friends you wish. Full board for everyone, plasma TV, swimming pool, free bar, plus 1,000 AUD spending money on arrival and your money will be invested to give you an additional 3,000 AUD on return home. I have 1,000,000 USD personal insurance. Nothing can go wrong. Call me. You good doctor.
 

BeanieBots

Moderator
Just a general question, how accurate are these simulators? Do they include gate capacitance on a mosfet or a coil going into saturation? Do you specify the coil core material, or is the model an 'ideal' inductor?
As I'd never heard of SWCAD III before, thought I'd have a look.
The first thing to note is that it's FREE. Always makes me suspicious because the more well known simulators are VERY expensive. Having read the "getting started" instructions, it looks quite good. Good enough to warrant a test run.

It's made by Linear Technology. A name you can trust. It's aimed specifically at Linear's products. (there's a surprise).
For inductors, you can (if you choose to do so) set the following:-
Inductance (goes without saying)
Peak Current (not sure what they do with that)
Series resistance
Parallel resistance
Parallel capacitance

So, not perfect but better than nothing and does assume that the user knows enough to put some values in.

For those interested, have a look for yourself.
http://www.linear.com/designtools/software/LTspiceGettingStartedGuide.pdf
And note the disclaimer on almost every page.

"Printed circuit board layout may significantly affect circuit performance or reliablity"

Unless you also model track resistance/inductance/capacitance, you will be in for some surprises!
 

Grogster

Senior Member
I agree with all the other comments.

If all you really want to do, is build what appears to me to be the equivalent of a medium-power constant current source, and provided the input voltage is greater then the output voltage required, this is how I would be researching it.

Naturally, this idea only works if the input voltage is HIGHER then the wanted output voltage, but now I'm looking at your diagram, it would appear you are trying to generate 12v from about a 3-5v input voltage. Assuming for the moment that you had a design that worked, you would need about 8-10 amps of current at the input, and I doubt that your solar panel would provide that much grunt(unless it is a humongous size!).

This is a generalization - there is more to it then that, but I hope it serves to indicate that building an inverter(generating a higher output voltage then the input voltage) is complicated and any inverter is always pretty thirsty for current on the low-voltage input side...

Think about the 12v-230v inverters you can buy to run mains appliances in your car.
Even a small stereo connected to the inverter, can suck upwards of 20-amps or more continuous from the 12v input to the inverter - this a lot of current - make big explosion if not terminated correctly and with correct circuit design!
:D

Don't be disheartened though, go back to the books, and do come back with any other questions.

If I may borrow from a Radio forum I was on once(forget where), a guy asked how to build an FM transmitter from scratch, admitting they had no knowledge of electronics at all. A response was something like(not verbatim as I am going from my memory): "Trying to build a functioning FM transmitter with no knowledge of electronics, is like trying to fly a 747 with no knowledge of avionics - not really possible."

I think this applies here until some easier projects are completed. Remember too, that the easy projects are a FANTASTIC learning curve - I really DID start learning Picaxe's simply by programming different LED's to flash on a basic Picaxe 08. I then moved up to 18X's, 40's(now called 40X1's I think...), now back down to 14M's. Each of them have given me more and more confidence and knowledge in how to use them. You still have little hiccups, but if you start at the beginning with simple stuff and work your way up, you find you can actually solve many of the problems yourself, but for the ones you can't, these forums are invaluable.

GOOD LUCK!
:)
 
Last edited:

BeanieBots

Moderator
Some good points Grogster.
I have found that anyone who does not have the time or patience to make an LED flash and genuinely be fastinated by it, will never have the ability to do anything more complex.
The flying example is a good one. One of my passions is model helicopters. People new to the hobby either put in hours of effort before even leaving the ground or smash it up on the first flight and decide the hobby is not for them.
 

womai

Senior Member
As far as LT Spice (also known as Switchercad) is concerned, that's a pretty popular, widely used version of Spice (not just hobbyists, but also in the professional world), given the fact it is free and quite powerful. It is of course optimized for simulations of Linear's range of voltage regulators, but it is also very capable as a generic Spice tool. The whole thing is basically being developed by a single guy at Linear, who about once every other year tours the world giving LT Spice seminars. There is even a quite active Yahoo group dealing with nothing else but LT Spice.

I wouldn't be to concerned with the disclaimers in the manual, I think it's understandable that Linear wants to avoid ANY legal trouble from a product they will never make any money from (at least directly).

I have used LT Spice for a short while in the past to modify a switching regulator design (used to produce a regulated negative voltage from a positive supply). Worked like a treat and gave results that were very close to measured circuit performance.

Wolfgang
 

parisien

Member
still there!!

hey guys !!!!

:) sorry for not replying. i readed carefully all ur comments, and i thanck you all for that. i had to take some steps back on my own, read, go through some theories, have an understanding of the problem, etc.... that is why i wasnt saying something, wasnt that much on internet. so ya.. my homework is still urgent, bt i think by takin some steps back, i can jump high. my simulation did go well,bt the implementation doesnt thats why also this passionate me more,and im more determined to make it work.

i appreciate all the guys who replied and want to unsure them that their critics werent rude, i actually like them. it waked me up,......

so guys my homework still urgent, i will still need ur help, will ask when necessety.;)

tanx again u all !!!
 

hippy

Ex-Staff (retired)
It's always best to say when a project is homework, although in this case it seemed there would be no urgency if that were not the case.

This seems to be quite a complex piece of homework which is hard enough for even the experienced to tackle. Are you sure you've not simply made things too difficult for yourself by setting your goals too high or misunderstanding the requirements ?

If it's a project chosen for you it is presumably to test your skills in solving it so I'd feel no shame in talking to the tutor to get advice as they probably have the best experience or maybe don't realise just how complicated what it is they are asking for.

If it's a project you chose for yourself then perhaps you could lower the target you are aiming for ? I'd feel much better and prouder in myself having delivered something using my own skills rather than having to use those of others, even if it were not such an impressive project as I'd like it to be.
 

Grogster

Senior Member
Some good points Grogster.
I have found that anyone who does not have the time or patience to make an LED flash and genuinely be fastinated by it, will never have the ability to do anything more complex.
The flying example is a good one. One of my passions is model helicopters. People new to the hobby either put in hours of effort before even leaving the ground or smash it up on the first flight and decide the hobby is not for them.
I actually find the "Avionics" in planes(especially modern ones like the A380 or 787) fascinating from an electronics point of view.

Computers really do fly our planes now - the pilot is more or less just a very experienced passenger!!! :D

Personally, I would love to be a pilot - but I can't stand heights, so...
:p

Sorry - off topic...
 
Last edited:

Grogster

Senior Member
Parisien, how about this as a more realistic and achievable homework project:
The girls will think it is much more trendy then a switchmode power-supply, and the teacher will probably appreciate the visual aspects too.(of the project, not the girls.)

EXPERIMENT: Build a colour-wheel display unit which displays moving patterns on a set of LED's connected to a Picaxe 18X chip.

METHOD: Connect 8 LED's of your chosen colour to the output pins of the 18X via a 330R resistor(orange-orange-brown-gold) - one LED and resistor per output pin, in other words. Arrange the 8 LED's in rough circle(use the points of an octagon shape as a reference for the correct positions). Don't make the "Circle" too large - say no bigger then the diameter of a CD or DVD disc. Program the 18X to turn various LED's on and off in one or more patterns.

You can use only one colour LED's, or several different colours - more colours would be more impressive.

With the large 2k of memory in the 18X, you can program lots and lots of different patterns to show on the LED's without running out of programming room to do it.

You could create moving dot, stepping, running, random, flashing, dazzle(flickering) patterns just to name but a few.

You could double the number of LED's to 16(2 LED's per 18X output), keeping the same 330-ohm resistor on each output as a current limit), but this would give you more LED's to spread out around your "Circle", although there would be two LED's lit at any one time instead of one. Simply connect the LED's in series: 18X-->330R-->LED-->LED-->GND.

You could even add a electret mic to the idea(using the ADC input of either pin17, pin 18 or pin1) with a few extra components, and have the code move the patterns when sound is detected.

A cute variation of this basic idea, is to build TWO strings of RED LED's - about 20 in each string, and using a smaller Picaxe 08, arrange the 40 LED's into two love-heart shapes, one inside the other. Each string of 20 MUST be driven via a transistor, as the Picaxe can't drive that many LED's at once - I could post a circuit if you like - it's easy to do.

You then program the 08 to turn the two strings on and off - outer "Love-heart" on for longer then the inner "Love-heart". Put the two love-heart symbols within an inch of each other, and the LED's making up the hearts relatively close to each other to maintain the effect. With the correct timing in the picaxe 08, the love heart will light up when powered, and appear to be "Beating" just for your girl(or boy if you are a girl!)

Either of these would make excellent classroom projects, and are quite easy to do. People tend to respond better to things they can SEE over clever things going on in a chip that they can't see:
"This chip is working out the correct relative position of a satellite dish, to it's corresponding satellite orbit around Earth."
"Very clever - have you seen this flashing thingy over here?!"
 
Last edited:

parisien

Member
gud news !!!

hi guys!!

good news is my boost converter is working.my problem now is to know :

1- if picaxe can support a lot of current and drive a power transistor,
2- i would like to know how to connect my picaxe ADC1 and ADc2 now on my circuit plzz???

im almost finishing with the code now.


tnax for ur help again!!!

plzzzz, urgent !!!!
 

hippy

Ex-Staff (retired)
1) A power transistor shouldn't require that much current to drive it so it should be entirely possible to drive it fom a PICAXE I/O line.

2) No idea.
 

BeanieBots

Moderator
Please post your new circuit.
In your original circuit you stipulated either 2N3055 or IRF530.
A PICAXE cannot drive either of those power transistors directly.
The hfe of the 2N3055 is too low for direct drive and the gate capacitance of the IRF530 is too high for direct drive when using PWM.
Also, as both your input cap and inductor were a factor of 1000 out, I'm expecting to see a considerable change from your original diagram to be able to comment on any analogue connections.
 

parisien

Member
hey

you are right, coz i have experienced it. the input capacitor after the solar array was for the noise. i will put a 4700 uF.

the inductor in the boost im using is a 100uH and its working cool. i just use a 2N3055 connect in darlignton, and the rest is the same. my switching frequency now is 9.1Khz and the duty is 63%. im quite happy with the results. now the output volt is 12.8V for 2.3A.
now i need to regulate with the picaxe, i tried to connect the ADC4 at the input and the ADC1 at the output, and of course the PWM. i stopped that because it was driving a lot of current. so im stuck with that part,and really dt know wat to do now.

tnx for ur help
 

Attachments

BeanieBots

Moderator
i tried to connect the ADC4 at the input and the ADC1 at the output, and of course the PWM. i stopped that because it was driving a lot of current
The first thing to do is buy a new PICAXE because the one you connected as described will be dead.
Any voltage above 5v on a PICAXE will kill it. The large current you observed was it being killed. Surprised you didn't see any smoke which is always a good indicator of destruction.

Anyway, your input is always below 5v, so it can be connected direct. However, I'd fit a 10k resistor in series just in case. It will also prevent parasitic powering of the PICAXE should the panel ever be connected when the PICAXE is not powered.

For the output side, you need a potential divider to reduce the 12v down to less than 5v. You need to take into account what the maximum is EVER likely to be. Let's say 15v. So, you could use 20k/10k.

The PWM can connect to the darlington base via a suitable resistor.
The maximum current a PICAXE output can supply is 20mA, so at 5v into about 1.2v (darlington base drop) you should use about 180R. Maybe 220R to be safe.

I'll leave you to work out if that will provide enough peak current drive for your (IMHO very low inductance) inductor. I=V*t/L.
 

parisien

Member
silly question. how to check that regaulation is perfect when connecting picaxe??

hey West !!!

tnx for ur help. now i solved the problem, the picaxe luckily is still working, i have tested it. i connect my picaxe to the boost converter n got the expected output. but now i wud like to know how should i check to see that my circuit is working and the picaxe is doind da job. coz i switched on, everything n live like dat, and it displays the same output value

so plz is it a way to know that the code dat u wrote is working?? dat ur regulation is perfect?? plzz let me know. hope is finalllllllyyyyyyyyyyyyyyyyyy working.

waitin 4ur reply guys. tnx.
 

parisien

Member
still

or should i just wait for da test with the solar cells to see the impact of the picaxe and see if the regulation is working???

or is it another way???
 

hippy

Ex-Staff (retired)
best wot iz 2 do iz to get wot 1 is naming as oziliskope and bangin that on cirkit iz wot showz it working bingo like
 

Pekari

Senior Member
or should i just wait for da test with the solar cells to see the impact of the picaxe and see if the regulation is working???

or is it another way???
Do what?

Test a ADC or make a boost converter?

Yes there is.

The latter solution doesn't include a microcontroller.
 

BeanieBots

Moderator
I wouldn't have thought any testing was needed.
You've done all the maths, you've got the simulation working and written the code. Your diagram shows your level of electronic competance.
Get the panels, hook them up and tell us how it all goes.
Looking forward to hearing about your results.
 

parisien

Member
problem with regulation

hey beanibots

i did the tests today and changed the input voltage, but unfortunately my duty cycle doesnt change, and when connecting the aircraft at the output and use the speed controller,my voltage drops from 13.2 to 8.02V.
i checked the duty cycle, it still the same. how can i solve that???

the feedback isnt working, the regulation is not done and the pwm is fixed. yes, seems like the picaxe is just producing a fixed pwm.

I connected a voltage divider for ADC1, and another voltage divider at the output for ADC2. from the output, i connected at a voltage divider to get a voltage less than 5V, for ADC2.

i used ADC1 for pin4, and ADC2 for pin6

plzz let me know asap, if you know what the problem is, maybe the code?? or the connection of the picaxe???

tnx
 

hippy

Ex-Staff (retired)
It could be your code, it could be your connection, it could be your resistor values. If the PWM isn't changing then it suggests that whatever calculates the PWM isn't having its input altered so that should give you a good starting point for adding SERTXD code for debugging.

I haven't bothered looking at the code so this is based on standard debugging practice. Find what doesn't appear to work, determine why it may not be working, then check the potential causes for that.
 

BeanieBots

Moderator
What Hippy says.

Maybe you could post your latest code and schematic for us to muse over.
Please show everything, especially your transient suppression components and snubber network so that we can determine if it might be noise from the coil causing your problems. A photo might be a good idea too to see if there are any layout issues.
 

BeanieBots

Moderator
Oh dear! Quite a few things wrong there!
Let's start with the regulator. It's 3v. Your potential dividers are for 5v.
Don't see any caps on the input either!
If you have what is drawn, I would expect the PICAXE to crash every time the 2N3055 turns on.
No value given for the regulator output cap.
Where is the PICAXE decoupling cap. With a smps next door, it's ESSENTIAL.

You have no filtering on either of the ADC inputs. They will see the raw smps ripple. Again, no cap on the panel will present MASSIVE ripple to the ADC. Readings will be meaningless.
Once you have the correct panel cap, calculate your max ripple and then calculate the filter cap for the ADC to give allowable tolerance on the ADC.

Same applies to the output. The 4700uF will help a lot but is it a LOW ESR type? There will be high freqency switch noise on it as well as the fundamental switching frequency. A 100nF cap on the ADC input pin should get rid of most of it. If not, you'll have to go to second order filtering.

You don't show a common ground connection. Hope you remembered to star-point it to the correct place on the switcher ground plane.

The MBRS340 has a 3A rating. Bit close for comfort but you will probably get away with it.

Now let's have a closer look at your darlington pair made from two 2N3055's.
Suggest you have a good read of the datasheet.
http://www.onsemi.com/pub_link/Collateral/2N3055-D.PDF

What's your peak switching current?
If you are still running at 9kHz and about 50% duty then from I=Io+V.t/L we get around 5A. This will be more at higher duty and massively so if your weeny little 100uH should decide to saturate:eek:
At that sort of current, you will see from the datasheet that the hfe drops into single figures. Worst case is 5. Yes FIVE.
So, the darlington pair give a gain of 25.

You are driving it from 3v via 180R. The base of Q1 will need to be at about 1.2v before conduction starts. So, (3-1.2)/180=10mA * hfe=250mA.
That's just a little short of the required 5A don't you think!

Anyway, once you've sorted that out, what about the switching speed of the schottky? The advantage of low volt drop is paid for by slow speed and low reverse voltage. You have no snubber to catch the transient before it starts to conduct. The 2N3055 is only good for about 60v. The schottky is about the same. Unless your layout is perfect then both are likely to pop due to over voltage. Suggest you scope it at low duty before letting it run at full duty. Let me know the wave form and I'll help you design the required snubber. Don't let it run too long or the poor little semis will get stressed.

In summary, you have a general concept drawing with some major floors.
It's now time to start the design of a proper switcher using REAL components or is this just a theoretical excersise?

By the way, I thought this was meant to be a MPPT controller?
How are you measuring power or is it a simple fixed load?
 

hippy

Ex-Staff (retired)
V1 indicates 8.8V, you have a 5K / 5K voltage divider which feeds ADC1. That will be delivering 4.4V into ADC1. With a PICAXE powered from 3V that is 1.1V above it's absolute maximum I/O pin rating.

You say the output is 13.2V, through 1K / 390 into ADC2 that's 3.7V which is also above the absolute maximum rating.
 
Top