Readadc:::New batteries:::: enhanced download circuit

Protolisk

Member
When I use a readadc reading to get the values from the xbox 360 controller trigger pots the reading changes depending on how charged the batteries are. Is there any way to keep them constant, maybe by using the enhanced download circuit?
 

Dippy

Moderator
readac use the PICAXE V+ as the reference for the ADC.
As battery volts change to the PICAXE then so will the ADC value, for a given voltage input.
Or if your PICAXE supply is dead constant and the pot. outputs vary with their own separate battery supply, then for a given pot position the ADCvalue will vary.

As you haven't posted the circuit or defined the power supply for each part it's difficult to be more specific. e.g. does PICAXE and XBOX use separate supplies?
Crystal Ball on standby......sleep, WDT time-out.....sleep...
 

Texy

Senior Member
To add to dippy's reply, the download circuit is only used to program the picaxe, and has nothing to do with reading ADC values. Using the Enhanced version isn't going to change the voltage level/ADC value. To keep the ADC constant, you will need to use a seperate supply voltage with a regulator.

Texy
 

hippy

Ex-Staff (retired)
@ Protolisk : You have four options ...

1) Power the PICAXE from an external supply and/or regulator.

2) Power the PICAXE from the supply which powers the controller / gamepad.

3) Read the controller / gamepad signal and read the supply whichpowers the controller / gamepad and calculate from that.

4) Read a reference voltage and calculate from that.

The usual option for a "Mod Chip" would be (2). For (3) and (4) you run into problems if the signals are higher than the PICAXE supply. You can voltage divide down the inputs but then you unnecessarily lose resolution when the PICAXE supply is above the signal voltage.
 

atharvai

Senior Member
just try powering the PICAXE from the XBOX controller supply. i'm not sure about what the supply for the XBOX controller is tho.

EDIT: I know know

you guys are just too fast and know much more than me. i come on here read a few threads now and then. can't spend enough time actually playing around with PICAXEs. but i am interested
 
Last edited:

Mycroft2152

Senior Member
just try powering the PICAXE from the XBOX controller supply. i'm not sure about what the supply for the XBOX controller is tho.

EDIT: I know know

you guys are just too fast and know much more than me. i come on here read a few threads now and then. can't spend enough time actually playing around with PICAXEs. but i am interested

Come on guys, this subject has ben rehashed so many times....

Do a Forum search, or do a GOOGLE search "XBOX PICAXE"

Myc
 

Protolisk

Member
Dam it seems like the caliadc command isn't available for the 08M.

I'm gettting the power from the controller batteries.
 

BeanieBots

Moderator
If you have a spare input, you can create the same effect as the calibadc function.
Hippy already suggested it (use an external reference). This could be as crude as a diode and resistor to give ~0.6v reference. The returned ADC value is then used to "calibrate" the real ADC reading.
 

BeanieBots

Moderator
The principle is simple but the practice is not.
I think BCJkiwi published a detailed article explaining it in the projects section.
In brief, you need to generate a reference that will not change with supply voltage. As explained, this can be as simple as a diode drop.
By measuring this 'fixed' voltage, you get an indication of what the supply voltage is. From that, you will have an indication of what scaling needs to be applied to your reading of the un-known voltage.
What makes the task tricky is the small numbers. The PICAXE can only cope with integers so some creativity will be required with the maths.
I'm not particularly clever when it comes to such code so I'll leave it to somebody else to produce the algorythms for you.

I'm more hardware oriented so I would adopt a hardware solution. I'd regulate the PICAXE with a low dropout 3v regulator to give a fixed Vcc. However, you would then need to understand what other interfacing requirements would be required to monitor/control the nominally 5v lines. This could be as simple as a single resistor but without good details about those lines it is impossible to say.
 

Protolisk

Member
hmmmmm sounds really complicated. Don't think I'll bother. Seems easier just to leave it as it is or use a seperate power source.
 

moxhamj

New Member
It isn't *that* complicated. You just need a regulated supply. For 5V that is one component - a 5V reg. It has 3 pins - in, ground and 5V out.

Feed it with more than 7V. You could use a 9V battery. Or a few AAs. I'd probably go for a 9V rechargeable battery as the picaxe will be drawing only 5mA which will give days and days of continuous power.

A 5V reg will cost maybe 50c. eg LP2950, or LM78L05.

Then all the analog readings will be fixed. If you are feeling keen you could look for 5V somewhere in the xbox. Or use a small plugpack and the 5V reg. Or a small plugpack with a regulated 5V output.
 
Last edited:

BeanieBots

Moderator
I agree with Dr Acula. I would be amazed if you can't find a regulated 5v somewhere in the XBOX. More to the point, using a supply from the XBOX should make things easier because everything would be referenced to common ground/Vcc making interfacing/supply easier.
 

Protolisk

Member
oh ok. But its an xbox wireless controller. And it has 3v and I think 2.4 if you're using rechargeable batteries.

Would it still be the same thing though except a 3v regulator? or 2.5v?

I dont know what regulator to use though.
 
Last edited:

hippy

Ex-Staff (retired)
I think you're going to have to find a circuit diagram if you can or trace it out from the PCB. It may well be that the controller is powered by two AA batteries but there could be on-board step-up drivers to turn that into 5V.
 

Protolisk

Member
hmmmmmmmmm yeah you could be right. If thats the case I cant be bothered. But is there like a regulator I can use. I'm thinking like a adjustable one since I cant find a 3v one near me.
 

Dippy

Moderator
I've never used an XBox so I am relying on crystal ball and imagination here.

If it is a simple pot you will have a high side, a low side(usually ground) and the wiper.
If that is the case, why not have the high side going into one ADC and the wiper going into another.
The high side will be the 'supply' voltage'
Surely then you can use this value to scale the wiper value.
Therefore you can have your PICAXE at a nice comfortable 5V (using a regulator!!).

Check all this with a multimeter first. You could even use those measurments and work some figures out on paper to get a grip on the very simple arithmetic involved.

PS. If you've got an adjustable Regulator 'near you' then get the info from the device Data Sheet on how to produce the voltage you want. And the world is FULL of 3V regulators. Check out your usual suppliers in Aus or look at farnells website to get some info.
 
Last edited:

Dippy

Moderator
All this is assuming that the pot is connected as above..

Use your multimeter to check the connections on the XBox pot pcb pads.
As I said, IF it is connected like a 'normal' pot you will have three pads.
A high - hopefully Vsupply
A wiper - the one that varies when you twiddle.
A low - hopefully ground (0V ref).

Obviously at any specific pot postion both the 'high' and the 'wiper' will vary with the supplyV - assuming no regulator.
An easy maths example.
1. The V supply is 10V, you measure the wiper = 5V. Pot at 50%.
2. Battery droops to 6V, you measure the wiper = 3V. Pot at 50%.

So, by measuring the pot high side with an ADC and measuring the wiper with another ADC you should be able to scale the wiper position.
Basically if the wiper ADC is half the High ADC then its at 50%. Yes/No?

Its just a suggestion ASSUMING the pot is wired in the traditional manner.
If it's not then I've just wasted 20 minutes :)
 

moxhamj

New Member
If it is just two batteries then you can't really use a regulator as there will be not enough volts left once it goes through the reg. So if you are going to need to add another battery, why not a 9V battery and a 5V reg? If you are using a 5V reg, my favourite is the LM2950. I buy them in batches of 20 and I'm just a hobbyist. I have a standard circuit for picaxe that I just install before I do anything - a LM2950 reg, and two caps across the picaxe power pins - 22uF tantalum and 0.1uF bypass.

Now the picaxe supply is regulated, you can measure the battery volts. Divide by 3 using a 20k and 10k divider network (1%). If the battery is 9V you will get 3V. If it drops below 2.7V, then flash a led to say the battery is going flat. Use a 9V rechargeable.
 
Last edited:

Dippy

Moderator
Well, yes very true, I was also assuming he'd do a regulated circuit like you've suggested Drac.

Stress: REMEMBER Protolik, the PICAXE uses its SUPPLY voltage for its refererence for its ADC.
Therefore if the incoming voltage to an ADC is (PICAXE V+)/2 then the ADC will give a number half the maximum of the 8bit or 10bit value.

It's really up to you to do a bit of measuring and experimenting now. I think all the basics (whichever method you choose) have been provided.
 

Protolisk

Member
So basically. All I do is use the power from the positive pin of the pot to power my 08m. Or do i have to do something with the code?

But Pot power----------pin1
 

BeanieBots

Moderator
Is there a constant voltage across the pot?
Measure it. What is it? Is it the same all for pot positions?
If the voltage is within the PICAXE max/min supply constraints AND it is constant no matter where the wiper is, then yes, you can power the PICAXE from it with the wiper going to an analogue input. The reading will then indicate pot position and not be affected by supply voltage.
 

Dippy

Moderator
BB: Post#15 suggests 2 cells. I think you'd be pushing you luck doing it like that.

Anyway, I've done my suggestions and leave it your capable hands... except to say, Proto, you are going have to do a little bit of investigation into measuring the voltages at the pot pins. And a BIG PLEASE:- A little bit of effort (5 minutes?) by you could save a lot of time for EVERYONE ELSE.
 

BeanieBots

Moderator
BB: Post#15 suggests 2 cells. I think you'd be pushing you luck doing it like that.
Granted. Not sure what the minimum spec actually is off hand, but I've not had any problems running 08/M from 2 X NiMh in practice. Programming is not reliable but running seems to be fine.

As you say, until Protolisk does his bit, there is little else we can do.
 

moxhamj

New Member
Re "So basically. All I do is use the power from the positive pin of the pot to power my 08m. Or do i have to do something with the code?

But Pot power----------pin1"

Sorry mate. That doesn't really make sense. The picaxe power comes from a battery or a regulator. Not from a pot. I think you will struggle if you try to do any analog voltage sensing and run the picaxe off two batteries. It needs to be supplied with a stable 5V. Anything else gets very complex in code. If you supply the picaxe with 5V, and you connect one end of a pot to 5V and the other end to 0V, and you feed the middle pin of the pot into the picaxe, you can measure the volts. With the pot wound one way, you get 0. Wind it round clockwise, and you will get 255. Put it half way and you get 128.

Any chance you could draw up a circuit diagram. Then we can make some suggestions.

Go down to Dick Smith Electronics and ask for a 5V regulator.
 

Dippy

Moderator
Yes, but until Protolik does some measurements or else everyone is in the dark.
Is the pot straight across V+ to Gnd? Dunno.
Is there a series resistor or anything else getting in the way? Between supply and pot? Between pot and ground? Dunno.

Proto needs to power it up, then:-
1. Connect multimeter BLACK lead to battery -ve. (We'll call this ground shall we?)
2. Put the knob or whatever at halfway.
3. Measure the supply Voltage.
4. Measure (if standard pot) the three pins/pads/wires whatever.
5. Take a note of the pad i/d or position on board and write the voltages against each one.
6. Do a sketch.
7. Post it.

And, for good luck repeat it for some other knob/lever postion just to see if there are any variations due to any loading.

Maybe not 5 minutes... maybe 10 :)
 

moxhamj

New Member
Darn it Dippy, is that xtal ball you got off ebay going cloudy again?! :)

To protolisk, Dippy is one of our all knowing, all seeing, gurus. Hippy is another. These are forum members who know what question you are going to ask before you ask it!

I guess we are trying to work out how much electronics experience you have. If the answer is "not much", that is fine. We can still help. If you can define the problem you want fixed, and you are prepared to wander down to your local electronics store with a parts list, people on this forum will even post a circuit diagram.

But I appreciate you might be running to a budget. I always was when I was younger so I know what it is like. Can you afford $10 for this project. Or $20?
 
Last edited:

Protolisk

Member
Well the next time I can go to an electronics store is on the weekend. So there isn't much I can do. I dont have a multimeter so I'll go get one there if I can.

I dont know if there is anything in between since its a pcb circuit board and I cant really figure out much on it.

Thanks for the help.
 

Dippy

Moderator
You're welcome.

BUT please remember, we need as much input/info as possible to help. My Ebay Crystal Ball is very annoying as it doesn't show me circuit diagrams for popular toys :) In fact I was going to send it back but the Beijing Crystal Ball factory has shut due to unforeseen circumstances.

A multimeter really should be a standard part of your toolkit if you are going to dabble in electronics. You can't always expect others to have instant solutions when we don't have:
A) the exact pcb in front of us.
B) a circuit diagram
C) A spare hour or two to devote to your specific project FOC.


PLEASE don't buy the cheapest one in the Store. I'm not suggesting a top grade Fluke, but get something which does a wide range of functions. Spend an extra few pennies...
 

BeanieBots

Moderator
My Ebay Crystal Ball is very annoying as it doesn't show me circuit diagrams for popular toys :) In fact I was going to send it back but the Beijing Crystal Ball factory has shut due to unforeseen circumstances.

...
I'd definitely send it back if it didn't see that one comming:eek:
Serves you right for buying the cheapest you could find;)
 

Protolisk

Member
Alright I wont go for the cheapest.

Well I found out that it actually gives out 1.5v but there's 2 of them. 1 for each trigger. Does that mean I can connect them up in parallel and use it for 3v
 

Attachments

Last edited:

hippy

Ex-Staff (retired)
I'm not exactly sure how you mean "it actually gives out 1.5v but there's 2 of them", I'll guess at 'apparent voltage sources'.

You cannot parallel up two voltage sources to increase the voltage. I suspect you may find those two separate supplies are the same supply to two different points, already paralleled.

No offence intended but it seems you are way out of your depth with this project simply guessing what might work, and missing some basic electronics understanding. All of us were in that position at one time and the best thing to do is to research the basics, start with smaller and simpler projects and as you understand 'what and why' you'll be able to progress to more advanced projects.

I have very basic electronics skills but get by - it would probably surprise many here that my analogue electronics skills go little further than Ohms law. I know five equations by rote, V=IR, P=IV, t=RC, Rseries=R1+R2, Cparallel=C1+C2, the rest I have to look up. When it comes to transistor hfe's etc I have no idea. It's quite easy to get by and go a long way without knowing a lot but it is necessary to have a basic understanding.
 

moxhamj

New Member
Re post 30 and 33, if you don't have a multimeter how do you know it is 1.5V?

You really will find a multimeter helps a lot. I have a patient who has some great stories about servicing radios and radar in WW2 in Papua and he had no test equipment at all. This was all valve stuff, and there was a lot of guesswork involved!

But why make it hard? Get the simple test equipment, measure some volts, get a 9V battery and a 5V reg and wire this thing up. It should only take an evening.
 

Dippy

Moderator
Sorry, protlisk, I haven't got a clue what your're talking about.

Even a basic sketch of where and what you are measuring would have helped.

I can get 7 volts out of mine.
 

Dippy

Moderator
Apologies, I was being cheeky.

I was just showing how confusing it can be when posting things without defining them or clarification.
I still don't understand (even with your piccy) where 1.5V comes from and what "it" is.

The trouble with Forums is that people (including me) usually only read the last few posts esp when they go on for days. You've got one project in mind, others have to look at dozens - add that to senile dementure for the 'old lags' and it means that that a bit more explanation is required per post.
 

BeanieBots

Moderator
You've got one project in mind, others have to look at dozens - add that to senile dementure for the 'old lags' and it means that that a bit more explanation is required per post.
What you trying to say Dippy;)
Interestingly, I fully understood what you meant by "I can get 7 volts out of mine." but was totally confused by Protolisk and was waiting for more description!
 
Top