Picaxe Query

  • Thread starter Deleted member 4366
  • Start date
D

Deleted member 4366

Guest
I'm still working on my programmable throttle interface, which will soften the throttle control and give a variable pedal assist that's controlled by + and - buttons instead of the speed of pedalling. I've now switched from a Genie chip to a Picaxe chip because the Picaxe has a direct analogue output instead of having to use a smoothed PWM output, but I'm a little stuck because this new function doesn't seem to be covered in any of the manuals.

I have an output variable of between 0 and 255. Does anybody know the basic command that puts it on an output pin?
 

Haku

Esteemed Pedelecer
Jun 20, 2007
339
4
Gloucestershire
You'll be wanting the DACSETUP and DACLEVEL commands for the M2 and X2 range of chips, however the DAC output only has 32 levels (0-31).

www.picaxeforum.co.uk is the place for some help from some very knowledgeable people including tech support from the Picaxe company.

I frequent that place quite a bit, I'm in the middle of building a capacitve discharge spot welder for putting tabs on batteries and a device that can charge/discharge/tell you the real capacity of four 18650 sized li-ion cells at once, as I intend to re-cell one or more of my ebike batteries and want to know the cells I eventually buy are good and to match them in parallel sets before spot welding them into the pack.
 
Last edited:

hech

Esteemed Pedelecer
Oct 29, 2011
352
27
argyll
I think that this industry and this country need people like d8vey and haku in charge, not just messing in sheds but teaching in universities - but mebe then you are already.
 
D

Deleted member 4366

Guest
Back in the 80s, every self-respecting kid (and adults that never grew up like me) went out and bought a microcomputer so that he could play games like Donkey Kong and Frogger on his TV. The only problem was that the computers were empty. You had to program them first before you could play the games, so you had to buy the relevant magazine for your computer and copy out pages of code into it. If you made a single mistake (like full-stop instead of a comma), the program didn't work. In figuring out what was wrong you learnt how to program - normally in some form of Basic. After that, some people got interested in how it worked and went on to learn lower level languages and machine code. The end result was that it led to a whole generation of programmers. Now the UK is the world leader in game design, like the previous generation, who spent their youth building Aifix and KielKraft kits and Meccano went on to lead the world in Engineering.

Sadly, now, all the kids want to do is sit in their bedrooms and play games, so guess what we'll lead the world in in the future - Thats right, nothing useful.

Anyway, Picaxe chips and other microprocessors are not difficult to fugure out. Of course it's easier if you've done something similar before, but otherwise, you just have to work your way through the manuals, To some it seems like rocket science, but just remember: In the land of the blind, the one-eyed man is king.

Haku, thanks for that. Now I know where to look in the manual, so I'll give it a go. I joined the Picaxe forum, but I'm not allowed to post yet - frustrating!
 
Last edited by a moderator:

Scottyf

Esteemed Pedelecer
Feb 2, 2011
1,403
-1
I like that description D8veh. Its interesting how minds develop and interests from a young age.
I played alot with Meccano and Lego and spent alot of time taking things apart rather than playing with them.

I think I found it more interesting in finding out how it worked, rather than it works.

I always find it fustrating that noone in the office seems to understand how an engine works. I'm not talking every single part in the IC engine but just the basics. Some people do not know how to change a tire.

No one appears to have a quest for knowledge and those that are interested only seem to be greeted with the "Why are you looking up that?" or Geek.
To be honest Ebikes are pretty geeky anyway...

Most slightly edgey useful tech is...
 

flecc

Member
Oct 25, 2006
53,559
30,848
So true Scotty, I cannot understand how so many now are content to know virtually nothing of the technical world in which they live.
 
D

Deleted member 4366

Guest
Yeah, they're girls blouses. We're real blokes and proud of it. I guess when the holocaust comes, we'll be the survivors.
 

wurly

Esteemed Pedelecer
Aug 2, 2008
501
9
Yeovil, Somerset
I used to take things apart just find out how they worked. How many people would do that these days? But then i was brought up to be a 'meccano' kid:)
What i find amazing is people surround themselves with hightech possessions and gadgets yet are completely lost when they fail or go slightly wrong, young'uns being the worst examples. For instance, my daughters 2 year old TV goes wrong and it has to be fixed quickly or they'll buy a new one. I'm a busy person, which means a week has gone by and i havn't had chance to look at it tut tut! they are ready cash in hand to buy another, it's only 500 quid!!! before i burst a blood vessel the back of the TV is off and i find 3 swollen capacitors. A quick trip to maplins and 1/2 hour later it's fixed...cost £3.49. It doesn't take real skill, just an intuition really. Being a tightwad helps of course.

Anyway, i can't help with your picaxe programming D8veh, but it does sound interesting. Is this one of those Ardinuino prototype board?


Quote from Scotty
'Some people do not know how to change a tire.'

Why would you need to change a tyre when you have a mobile phone?
Call your (insert)father, husband AA or anyone rather than learning how to do it yourself)
 
Last edited:
D

Deleted member 4366

Guest
Being a tightwad helps of course.

Anyway, i can't help with your picaxe programming D8veh, but it does sound interesting. Is this one of those Ardinuino prototype board?
Being a tightwad is nearly a prerequisite.
picaxe or Genie is like an Ardinuino. You can build a little project board from a kit that just costs a few pounds. Then £10 for a programming lead; you download their software; and you're ready to go. The chip basically takes inputs from switches or sensors and you can apply some logic to control output switches, sounds or voltages. Ideal for making a self-watering system for your greenhouse or something like that. Both Picaxe and Genie can be programmed by flowchart software, where you don't need any programming expertise. The project boards can be put together like an Airfix kit, but you solder instead of glue. So, it isn't that difficult as long as you have a logical mind.
 

wurly

Esteemed Pedelecer
Aug 2, 2008
501
9
Yeovil, Somerset
I have been thinking of building a throttle interface using one of those Arduino boards. I have an analylog circuit(opamp) that reduces thottle signal depending on how much current is drawn. It works ok on smaller low amp controllers but can be a bit jerky (on/off switching) on higher power controllers.
When (if) i recieve my BPM motor i will try it on my diy circuit, but if i get this oscillation then i'll investigate building a throttle interface. What ever prototype board i choose, it will have an analylog output to overide or clamp the throttle signal voltage. The picaxe pcb you are using seems ideal for this.
I have done some basic programming before so i need to dig out my old project folders from a few years ago. Higher level languages are no no for me. One piece of code and i get 50 errors:confused:
 
Last edited:
D

Deleted member 4366

Guest
I've just found out that it's not so easy. The analogue outputs need buffering with an op-amp. It's much easier to pulse a digital output(PWM) and use a low-pass filter to convert it to analogue. That's how I did it on my mark 1 version. A guy on ES did a very neat job with his throttle interface that was designed to add a smoother ramp to the throttle, but it could also be used to limit the throttle or speed control as well. Top of page 2.
Endless-sphere.com • View topic - smoothing out the throttle
 

flecc

Member
Oct 25, 2006
53,559
30,848
That dual TL0 72 solution is pretty neat, I like the simple diode bypass idea to give asymmetric operation.
 

wurly

Esteemed Pedelecer
Aug 2, 2008
501
9
Yeovil, Somerset
I've been thinking about that analog circuit using the 2 opamps and i reckon' it could easily solve my current limiter problem. It acts as a nice slow ramp up throttle signal conditioner which will hopefully eliminate this on/off pulsing i get with my circuit. Funny enough we were discussing using a form of opamp integration for signal conditioning at work, but i was getting out of my depth, this is what we were trying to acheive. I can add this to my original circuit. This(if it works) going to be easier than programming development boards.

Funny to think, the same circuit used as a glide control on a mini-moog synthesiser, re-invented for use on an ebike.