View previous topic :: View next topic |
Author |
Message |
Per Svensson
Joined: 03 Oct 2004 Posts: 235 Location: Gothenburg, Sweden
|
Posted: Tue Dec 21, 2010 1:56 pm Post subject: Artificial Intelligence? (AI) |
|
|
A bit off topic - I know...
But I will move to an interest group as soon as (or IF) an interest arise.
(So Mark. You can stop reading here. This is not a service topic)
Ok - so you have this wonderful three axis magnetometer sensor soldered into your AVR-board and switch the power on.
You get signals, but unfortunately you find that these are a little bit off.
First of all there are offsets in the sensor and the A/D
Then the scale factors are not quite right either. So the output signal is:
M(x,y,z) = Kx(X-X0), Ky(Y-Y0), Kz(Z-Z0)
Now, you can try to find the offsets X0, Y0, Z0 and the gain factors
Kx, Ky, Kz by exposing the unit to known magnetic fields of six very well known directions and then apply some mathematics to resolve the six unknowns. This is not easy.
Alternatively you could use Artificial Intelligence (AI) to find the sought parameters.
This is where I would like to interest you Bascom enthusiasts.
Calibrating all kind of sensors require a great deal of knowledge about its behavior. The beauty of AI is that you can get successive improvement of a system without detailed knowledge if its internal mechanisms.
All you need to know is how well it reacts on certain stimuli.
Genetic Algorithms (GA) is a method to do this.
Creating a population of "chromosomes", consisting of "genes" (which in the above case could be the six calibration parameters) is the starting point.
Then we expose the sensor to arbitrarily chosen magnetic fields
over and over and over again... we let evolutionary inheritance mechanisms search to optimize a "fitness factor". This factor is a measure of how well adaption is progressing.
Amazingly enough - after a few hundred (or thousand) generations, a solution is closing up (!)
Eve though we do not know HOW the system works, nature will find a solution.
Does this sound interesting?
If you think this is something you would like to know more about, or perhaps already have skills in, we could create an interest group to gather knowledge, and perhaps to design an AI library for Bascom.
Most GA functions are the same and can be reused for numerous problem types. It is just the fitness function that need to be tailored to your particular task. (Chromosome coding might also need some variations)
If you have never heard about GA before then run this demo solving the traveling salesman's problem to get a feeling for what it can do.
http://en.wikipedia.org/wiki/Travelling_salesman_problem
http://www.codeproject.com/KB/recipes/tspapp/tspapp_exe.zip
Well - this was just a quick intro to tickle your interest.
/Per |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Tue Dec 21, 2010 5:44 pm Post subject: AI |
|
|
Hi Per,
the problem I see with the Atmel chips is the difficulty to alter it's own program.
There would have to be an external memory to store the altered program and reload it. The memory needs to be (depending on AI capabilities) very large. With Atmega or Atxmega not so much, ARM maybe fast enough to get some realisticly timed results.
The TSP in it's many forms is a good example but there are often factors missing to relate to the real world.
What if the salesman travels for 5 days, visits numerous cities, some customers can be reached only at a certain day and time, some of the cities do not have a place to stay over night, roadconditions, traveltime, random delays..see my point?
In a PC recources are much easier to handle.
Maybe it would work on a small scale.
How would you for example handle a very time dependant control function on a RC-airplane, it would have to be exercised before takeoff.
Interested? Yes.
Hubert |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Tue Dec 21, 2010 7:23 pm Post subject: |
|
|
Maybe that's even more OT, but we don't need artificial intelligence, it would be enough if the world would have some real intelligence.
Merry Chrsitmas to all. |
|
Back to top |
|
|
Per Svensson
Joined: 03 Oct 2004 Posts: 235 Location: Gothenburg, Sweden
|
Posted: Tue Dec 21, 2010 7:40 pm Post subject: Artificial Intelligence? (AI) |
|
|
Hi Hubert,
In most cases the program is not the target for altering.
When training a sensor for instance, you want to modify some parameters only, and these are stored in EEPROM. No need to alter code.
It is true that you need some sram space for storing the population of chromosomes, but not extremely much. A chromosome can typically be 10 bytes in length and there might be 80 chromosomes in a population. That is not more than 800 bytes. Not unrealistic at all for an AVR with 4-8k sram.
Speed could be an issue, but many physical processes are rather simple to evaluate. (take the magnetometer for instance. Slow bandwidth and easy to stimulate. Just tie it to the back of your dog during a walk in the park, and he will do the exercising)
/Per |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Tue Dec 21, 2010 10:22 pm Post subject: |
|
|
Hi Per,
one candidate for an MCU might be Atxmega192A3 or 256A3-AU.
Not too expensive, has quite a bit of memory, is available and can interface to a multitude of sensors and devices and with a pin distance of 0.8 mm it is still relatively easy to make a bord at home.
I'm thinking of possibilities like GPS, gravity in 3 axis, temperature, airpressure and maybe even gas, magnetic, audio and optical sensors.
That would certainly be enough to start out with.
When Mark Alberts releases his ARM version, then it could progress to that.
MWS,
that is exactly why we need the intelligent hardware!
Hardware that is programed by people who are not dumbed down by the media or other related entertainment yet.
It would be great if Mark Alberts could and would provide a corner to start that,
kind of like the DOS section. I am sure there would be a lot of good uses coming out of it as a result.
Hubert |
|
Back to top |
|
|
Per Svensson
Joined: 03 Oct 2004 Posts: 235 Location: Gothenburg, Sweden
|
Posted: Tue Dec 21, 2010 11:39 pm Post subject: Artificial Intelligence? (AI) |
|
|
Right on the nail Hubert.
You see, I am currently using Xmega192A3 for this purpose,
but also an ordinary mega128 could be a candidate.
You are also right that we must be rather openminded to adopt these AI tecniques. (GA, FuzzyLogic, Genetic Programming and so on)
It is important that we dont just turn these intersting tools down just because they seem to be too "exotic".
And again - Waiting for ARM is not a reason for not diving into the subject.
Furthermore - Xmega running at 32MHz is a very competent little creature.
Especially when running 8 ADC channels more or less simultanously at 2Ms/s
/Per |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Wed Dec 22, 2010 8:22 am Post subject: |
|
|
hgrueneis wrote: | Hi Per,
When Mark Alberts releases his ARM version, then it could progress to that.
Hubert |
I know I will buy it and so I think will many others, hope he sells heaps! |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Dec 23, 2010 11:36 am Post subject: |
|
|
If you like a forum for AI/fuzzy, let me know and i have it created.
I also need a moderator for that forum then. _________________ Mark |
|
Back to top |
|
|
ex4
Joined: 13 Jan 2006 Posts: 1062 Location: indonesia
|
Posted: Thu Dec 23, 2010 12:02 pm Post subject: |
|
|
oh, fuzzy
been implemented it once for temperature controller on AVR
but it fuzzy me
PID controller is much more understandable for me
any simple example for newbie? |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Thu Dec 23, 2010 4:59 pm Post subject: |
|
|
Mark Alberts,
this is a very kind offer. Maybe with time some of the over 16T registered users will be interested too. One in 1T would be good for a continued activity.
Per,
What's your answer? Will you be the moderator? You seem to be the most qualified.
Never started a workgroup with two people but who knows.
One little input at first: Fuzzy, I assume is protected (AI is not), we would have to call it something else so we do not anger or confuse anybody. Original Fuzzy software is quite expensive.
What I have done in the past was an algorithm with a percent component that worked (not perfect but OK).
For sure this workgroup would at least generate sniplets for control applications that many could implement in their programs.
Anybody who reads this, please let us know if you are interested.
Hubert |
|
Back to top |
|
|
Per Svensson
Joined: 03 Oct 2004 Posts: 235 Location: Gothenburg, Sweden
|
Posted: Thu Dec 23, 2010 5:10 pm Post subject: Artificial Intelligence? (AI) |
|
|
Mark, I am willing to shoulder the moderator function for AI,
but i suggest that we give it a few more days before you create the interest group.
There have been some interest, and many readings, but not so many comments, so perhaps we won't get the "critical mass" ?
It would be very interesting to get a feeling for how many of the approx 250 readers that are interested enough to participate actively.
This group should act both as a forum for discussion around AI, but also an active interest group where eventually an AI library could grow. Ideally e few individuals could gather and form subgroups with special skills around "their" subject. Together building a basket of routines for solving tasks that we so far have had no chance to approach with traditional methods.
I feel that we need to rise coding to a higher level by lifting the abstraction level successively.
I realise that the Bascom society is a heterogeneous group of programmers, (and that is the beauty of it) but it is also large enough to form team with special interests and skills.
It would be nice if also other groups could form. For instance:
- Mathematical methods (signal processing (light))
- Regulators and controls
- OS (AVR-DOS deserves more interest)
- RTOS (Perhaps AVR-DOS can become an RTOS as well)
- Human interaction (Menu systems and graphics etc...)
- Graphic drivers (We get more and more complex displays)
Many forum members do fantastic things, but i feel most of them fall flat because no one knows how to take care of it and push it further for the benefit of all. We need a "Linux attitude" I think...
What is your general attitude to ideas like these Mark?
I would also like to take the chance and send a Merry Christmas to
all member from a frosty and white Gothenburg.
/Per |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Dec 23, 2010 9:54 pm Post subject: |
|
|
Thanks Per for offering your shoulder.
yes, for a forum we need some interested and participating users.
so lets wait for some input.
I do not mind if there are only 2 or 3 users, after all, you never know who joins later. when i started with bascom there were also a few users.
There are indeed a lot of topics that can use more attention. but lets put focus on the AI/Fuzz.
Thanks for the wishes, it must look great in Gothenburg.
Merry Christmas ! _________________ Mark |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Thu Dec 23, 2010 10:10 pm Post subject: |
|
|
Let's see if memners are interested to advance programing methodes.
To everybody also a Merry Christmas (or great celebration for whatever you celebrate)
from not frosty but very sunny (mild summer) Tucson, Arizona
Hubert |
|
Back to top |
|
|
luizabbadia
Joined: 11 Dec 2007 Posts: 112 Location: rio de janeiro
|
Posted: Mon Dec 27, 2010 6:06 pm Post subject: |
|
|
Hi! I would like it very much , but I must confess that I could feel myself like Penny in the Big Bang Theory episodes among the high level guys!!!
Anyway , IŽll try to follow the ideas and I promisse not to bother.
Thanks |
|
Back to top |
|
|
AdrianJ
Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
|
Posted: Tue Dec 28, 2010 12:09 am Post subject: |
|
|
While I agree that some advanced program techniques like "AI" have a place, I wonder whether in any particular example they are worth doing, particularly in the sort of environment we find for processors like AVRs.
Take your original example, of finding the gains and offsets of a certain sensor set. Assuming these dont change over time and/or temperature, then a one-off calibration to determine them is all that is ever needed. Do you really want to put in a whole lot of very complex code, just to determine some values you can measure directly on the bench, and only needed once ?
Even in the case of temp changes, a calibration over temperature still sounds easier to me than implementing "AI" just to do this.
This calibration problem is a relatively minor issue compared to the real complexity ( say ) of understanding the physics and maths involved in fusing several sensor measurements to extract the flight dynamics of an aircraft. Should you not be worrying more about understanding this much more difficult problem ? Yes I know there are tools like the Kalman filter to handle some of this. But you still have to understand the physics to know whether the model you use and the results you get are meaningful or not.
I take the point that "AI" can be used to solve much more difficult problems, like instances of the travelling salesman problem. But do we really expect that we use things like AVRS to do this class of processing ?
I too have done some very "intelligent" stuff ( at least I like to think so ), including things like developing a strategy for searching a database where the search time is fixed, independent of the size of the database. But this did not involve "AI", just a realisation that what I wanted to search had some special properties. I truly doubt any "AI" type program would ever find that sort of algorithm. _________________ Adrian Jansen
Computer language is a framework for creativity |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|