Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:33 09 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Commercial product Using MMbasic?

Author Message
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 10:10am 30 Mar 2013
Copy link to clipboard 
Print this post

Hi all,
Just thought I would outline a project I am considering porting to MMbasic and Maximite(or clone). I am an engineer for a company which produces wood boilers. I head a team which has designed a high efficiency unit currently in testing. This product would benefit from a field up-datable easy to modify control system which dealers or service techs could understand.

PROJECT DETAILS:
5- K thermocouples IN via SPI
1- Oxygen sensor IN 0-5v
4- NO switches DIO
2- Quad encoder IN 5v

2-DC motor OUT via serial packets
1- BLDC motor OUT 0-5v

Control system uses PID for actual motor output but fuzzy logic for state determination (fancy name for IF-THEN!).

This is a big project (2.5 M$) with partial funding by State money here in the USA. I have not written all code yet... just trying to get things talking. I am a bit concerned with program size and execution speed. Has anyone written a program to big to fit? Where is the glass ceiling?


CONCERNS:
(Geoff) I know a big driver in your effort revolved around an 'open source' paradigm. In other words, we all should feel a moral responsibility to pass on and disseminate knowledge to others (esp. the young) without selfishly requiring $$ for it.
What are your thoughts? Where is the line between educational/hobby/commercial use drawn?
I ask this in a public setting so we can all be on the same page. I firmly believe that some type of income stream must be in place for a project to be sustainable. It's not about $$ so much as attributing value to everyone's efforts. Without it we end up taking each other for granted.

Thanks, Frank
PS- I know, I know ... I've waxed dogmatic! Sorry
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 02:01pm 30 Mar 2013
Copy link to clipboard 
Print this post

Hi Frank,

I believe that you should do some serious evaluation and testing before using the Maximite (colour or mono) as a key element in a million dollar plus project.

This is not because it is flaky (the hardware/firmware is quite stable now) but because the Maximite was designed as a low cost single chip computer for hobbyists. It may do your job quite well but there also might be a hidden "gotcha", this is why you need to evaluate/test first.

Running in monochrome the memory limit is about 2,000 lines of code (which is a lot) but this will be reduced considerably if you use lots of arrays, strings, etc so it is hard to generalise. This limit is fixed (there is no expansion) but you can partially get around it by modularising your code and using the CHAIN command.

If the project is a major one and supported by the government I would be happy to license the source (at no cost) for the project. That would give you the security to maintain and expand the firmware even if I get run over by the proverbial bus.

Geoff
Geoff Graham - http://geoffg.net
 
Nick

Guru

Joined: 09/06/2011
Location: Australia
Posts: 512
Posted: 03:13pm 30 Mar 2013
Copy link to clipboard 
Print this post

Do up an outline of what you want, showing what data is being fed in and what outcomes you want out.

Maybe do up a simple screen layout (hand drawn and scanned is fine) of what you envision.

Nick
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 04:12pm 30 Mar 2013
Copy link to clipboard 
Print this post

Hi Nick,
Me and my boy are loving your work! I like your coding style; NO BLOAT, careful memory management.
Thanks for the reply. The project is already running under different language and hardware. Some limitations of our OTS boards are addressed by MMbasic which is why I am considering a move.
I was just trying to get a handle on how overall instruction count might influence speed and perceived latency. Geoff's post helps a bit and I'll just have to put in the time and get a significant amount done and see.
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 05:30pm 30 Mar 2013
Copy link to clipboard 
Print this post

Geoff,
Yeah, We do ALOT of in house testing before turning these things loose. I set up a 'lab' in our back warehouse which logs data into LabView. Everything is watched (e.g chip temp over time). We have been through UL safety testing and have redundant mechanical limits to make sure things fail safe.
I've had CG's products for about a month, tried most commands I thought might trip me up, built a proof of concept board with all our sensors and actuators, and made things wiggle to the extent necessary to approach the team with a proposal.
As far as the risk to this project goes I've learned some valuable lessons:

Some 'hobby' products are truly innovative.
Industrial boards are hobby boards which foresaw all the what-ifs.
With the right protection and environment ANY board can be made stable.
A good virtual machine by developers which specialize in a particular chipset will beat me banging away at registers every time as far as robustness.

I do appreciate the cautions though and I will do my best to expose them to the decision makers accurately.

Thanks for the offer on the source code also. I just wanted to be above board about what we are intending to do with your work.

I will say Geoff that you may have underestimated the value of what you have here. Some have billed the Maximite as a toy, game platform, or throwback to the 80's.
But...
ALL the industrial automation players are writing high level "EZ" languages to replace the PLC lines which were the mainstay for so long because they could be programmed the way an operator or electrician thought. Almost NONE of them have gotten the fact that an on-board development IDE is the direction that works best. 99% of all industrial control stuff is simple sequential control with some basic logic sprinkled in. NOT processor intensive or particularly time sensitive!
The Maximite and 12 relays constitute a very powerful control center which is very easy to program. What factory with $20,000 in modules from Seimens which pays $90.00 / hr for programming would not want one.
Instead of a cool board with tons of features and a hobby interface header; what would a board with 10 opto relays and 0-10v industrial IO running a beautifully protected environment with full error checking be worth? That a kid could re-task in minutes?
Priceless!

Keep up the work, Geoff. We'll see where we can take this

Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3673
Posted: 04:12am 31 Mar 2013
Copy link to clipboard 
Print this post

Some offhand thoughts:

If you haven't already, grab the existing open source MMBasic code (before Geoff changed) and have a look at it so you know essentially what you would be supporting yourself if need be - I think you'll find it's understandable C that you or any competent C programmer could maintain

Oh, and get Lucio Di Jasio's book "Programming 32-bit Microcontrollers in C: Exploring the PIC32" as that's what Geoff based quite a bit of the code on.

Consider the Olimex DuinoMite boards as they are industrial range.

Memory usage of strings might be a problem but if you know that in advance you can avoid using more than you have to.

Although you could CHAIN I doubt you can spare the time to do it or dare trust an SD card to keep working.

Overall, bearing in mind this country used to run its main power stations via a variant of Basic on PDP-11s (but no bit-banging of serial ports and no clever stuff for video), I don't see why what you have in mind would be impossible.

John
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 07:32am 31 Mar 2013
Copy link to clipboard 
Print this post

John,
Nice suggestions. Although 'competent programmer in C' might be pushing it! Old dog with not that many tricks to start with.
I was wondering about CHAIN load time; haven't tried it yet so thanks for the heads up.
Frank
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:58am 31 Mar 2013
Copy link to clipboard 
Print this post

If you don't want to be depended on an sd card with the CHAIN command you could also use the A: drive that is in internal flash memory. That will have the advantage of loading quick and one point of failure less.
I have some modular designs ready that are compatible with the CMM and am willing to change some of my project priorities if you would need some specific hardware.
Maybe it could be beneficial to us both.


Microblocks. Build with logic.
 
Greg Fordyce
Senior Member

Joined: 16/09/2011
Location: United Kingdom
Posts: 153
Posted: 12:11pm 31 Mar 2013
Copy link to clipboard 
Print this post

One thing to consider is that what makes the MM great for one off projects is how easy it is to change/edit software in the device. In a commercial product this could be a problem if someone "improves" your code and introduces a bug that makes the machine unsafe.
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 02:22am 01 Apr 2013
Copy link to clipboard 
Print this post

  Quote  One thing to consider is that what makes the MM great for one off projects is how easy it is to change/edit software in the device. In a commercial product this could be a problem if someone "improves" your code and introduces a bug that makes the machine unsafe.

I thought of that Greg.
I plan to disable <BREAK> and use an Autorun file from internal flash. Interface by using custom button board for navigation and AV small display. So to the end user it would not seem customizable.
I intend to send bug fixes/updates via SC card which would house a program made unreadable to the casual eye by a simple substitution algorithm. The user would then press an "Update" button which CHAINS an onboard decryption routine and writes the result to Flash as a new Autorun.bas.
For a dealer or service tech we would provide a keyboard and SD with diagnostic and configuration Programs. With training they could load a new resource file to FLash and re-boot. I believe with enough scarey warnings the end user would not muck about trying to modify an expensive ($8,000 USD) product.
I've written this stuff already and feel quite clever!
  Quote  If you don't want to be depended on an sd card with the CHAIN command you could also use the A: drive that is in internal flash memory. That will have the advantage of loading quick and one point of failure less.
I have some modular designs ready that are compatible with the CMM and am willing to change some of my project priorities if you would need some specific hardware.
Maybe it could be beneficial to us both.

TZ.. Yeah I plan exploit internal storage as much as possible. SD for data logging, BMP's, and user help files. That's one reason I want to stay with Mono; for the space. Geoffs estimate of 4000 lines is daunting as I am at ~10,000 with the current setup. With MMbasic so much more can be done per line though.
Thanks for the offer on collaboration. I will keep you all posted on my progress and listen for ways to offload things I am not proficient at.
Frank
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1084
Posted: 10:57am 02 Apr 2013
Copy link to clipboard 
Print this post

You list 2 quadrature inputs. How fast do they need to be?
Visit Vegipete's *Mite Library for cool programs.
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 11:50am 02 Apr 2013
Copy link to clipboard 
Print this post

vegipete,
Not fast, just to verify an actuators position. Encoder puts out 64 PPR; gear reduction is 100:1; and I will rotate 270deg in one second. So what's that 6Khz?
I won't use the MM to close the loop anyway; the timing gets knotty in a hurry. I posted separately a very cool driver which does it for me with full error checking for $30US.
Why? Did you have a better solution?
I do have a piece of spaghetti code to track a mechanical encoder for user input. It is cleaner for entering a value than a keypad. I feed it upper and lower limits and a start value and it spits back how far from that value the knob has turned. Needs work though.

Frank
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1084
Posted: 06:48pm 02 Apr 2013
Copy link to clipboard 
Print this post

  Quote  Not fast, just to verify an actuators position. Encoder puts out 64 PPR; gear reduction is 100:1; and I will rotate 270deg in one second. So what's that 6Khz?
Yes, I agree with your ~6kHz pulses. Times four = ~24 kHz if you count edges.

My seat of the pants impression of the MM is that it won't be able to reliably read an encoder at those speeds, especially if (software) debouncing is required.

Like you, I too like using an encoder for user input, especially if has a built in push button. I really like the Grayhill 62P22 sensors.

For a neat code trick for reading encoders, try using the current 2 bit encoder pattern OR'ed with the shifted twice previous encoder pattern to generate a 4 bit index into an array of count changes. The array will contain 16 entries consisting of +1, -1 and 0 values, depending on the present and previous encoder states.
Visit Vegipete's *Mite Library for cool programs.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3673
Posted: 10:45pm 02 Apr 2013
Copy link to clipboard 
Print this post

More on using MMBasic - make sure you are 100% happy with the licence. Bear in mind it has already changed dramatically (from open source to closed source) so this is not something to overlook.

John
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 04:25am 03 Apr 2013
Copy link to clipboard 
Print this post

  Quote  For a neat code trick for reading encoders, try using the current 2 bit encoder pattern OR'ed with the shifted twice previous encoder pattern to generate a 4 bit index into an array of count changes. The array will contain 16 entries consisting of +1, -1 and 0 values, depending on the present and previous encoder states.

Neat trick indeed! And a reminder to think truth table first algorithm second!
I will use the method.



  Quote  More on using MMBasic - make sure you are 100% happy with the licence. Bear in mind it has already changed dramatically (from open source to closed source) so this is not something to overlook.

John

Hmmm... Can of worms there.
I have pondered this a lot. Open vs closed source- Duinomite vs. Maximite. Other than the altruism factor which I've already stated; the premise is that a group of talent will always be more than the sum of it's parts (like this forum). Sounds good. BUT...
With a single developer,what the user gets is a reflection of the person (or company); whereas open source reveals human nature in general. Closed source forces we the people to adopt the direction and values of that singular mind. We don't like that. I cite the Windows vs. Linux debate. Windows is nice but feels a bit seedy. Linux is in the never-ending pursuit of perfection in a maelstrom of 7 billion opinions ('flavors').
So the real question is: Can I live with Geoff's vision or do I want something else?
ANSWERS: At his heart I believe Geoff has the best interests of the Maximite/Duinomite community for a motivation.
Is his implementation perfect? No, I have a wish list like all of us.
Is the pain evident in Geoff's article "The problems in open source" a result of wounded pride from what he sees as an attempt to upstage him? Yes, we all have that component about us and we can be deeply cut when we have attached our generosity to something.
Do I think DMbasic IS inferior? No, not to those who worked hard on it. It is vastly superior to what I could have done... and (like Linux) it addresses some of the core limitations of the MMite.

So for me, as long as Geoff can and will keep up the struggle to evolve/improve MMbasic I think he did me no dis-service in 'closing' the source. He is a better programmer than I; and I get a product which is mature and priced right! If he abandons the project I will wish for the source of course. But I have seen nothing so far which indicates Geoff has any desire to hold his knowledge for ransom.

However it is all opinion and speculation. Not worth much to any but I; it only explains why I started this thread. (I have tremendous insight... I'd use it on myself but I have no problems!)

Frank

PS- After reading this I realize I spoke about Geoff in the Third person. Sorry Geoff no malice intended.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 12:07pm 03 Apr 2013
Copy link to clipboard 
Print this post

MMBasic is closed, but then again it is not. :)
If you make an request to Geoff for the sources, they are available under certain licensing terms.
You can read about it here


Microblocks. Build with logic.
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 12:24pm 03 Apr 2013
Copy link to clipboard 
Print this post

  Quote  MMBasic is closed, but then again it is not. :)
If you make an request to Geoff for the sources, they are available under certain licensing terms

Yep... The best type of governance. Benevolent Monarchy.
Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3673
Posted: 10:12pm 03 Apr 2013
Copy link to clipboard 
Print this post

This thread is about commercial. For that you would be wise to get terms agreed before committing to the product. That way it would not matter whatever happened in the future, even something unlikely such as Geoff getting a brain condition leading him to change the terms into something very unacceptable to future people.

None of this matters to a hobbyist and nor am I suggesting any malice or indeed medical matters but commercial reality is to get things certain and acceptable even in unlikely situations rather than leave risks. It's akin to real-time issues with life-endangering equipment where you really need to assess risk very carefully.

Or you just shrug and hope. It's not my business!Edited by JohnS 2013-04-05
 
StoveMan
Regular Member

Joined: 29/03/2013
Location: United States
Posts: 51
Posted: 01:13am 04 Apr 2013
Copy link to clipboard 
Print this post

JohnS,
Very true; thanks for bringing me back to reality! You make a good point.
The problem is I tend to only see things from the R&D side of the fence I guess.
Frank
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3673
Posted: 02:12am 05 Apr 2013
Copy link to clipboard 
Print this post

Just to mention I'm not wanting to put you off. And I expect Geoff will provide OK terms.

If later on you do need tweaks to the code you can find a C person with uC abilities if Geoff's not available.

John
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024