Multiple PICAXE system

Tvmender

Active member
Hi All...

I was posed a question recently by my daughter who is following in my footsteps and studying to be an Electronics Engineer. I left the trade several years ago but still do it for a hobby.

She asked me if its considered lazy or innovative to use multiple microcontrollers in a system to eliminate hardware where possible (where a single device would not suffice). For example, using a PICAXE to simulate the function of a sequencing 4017 eliminating the need for external oscillator and making it infinitely adaptable or replacing a comparator circuit eliminating multiple components all of which would be part of a single circuit.

I said innovative but maybe not commercially cost effective.

Thoughts?
 

kranenborg

Senior Member
My first quick thought: If the system itself has its intelligence essentially distributed, then a distributed implementation of that system using multiple controllers at the right spot may be a more effective solution from both hardware and software perspectives (the distributed HW solution is likely simpler, the software solution may be easier to implement as it is based on distributed processes itself (which communicate with each other), which then can be mapped easier to the controllers.
I do not have a specific application at hand, but an octopus immediately passed my mind ... . I can also imagine robots and other complex systems which rely on sensor information from many different locations. They may profit from such an approach (processing and maybe even deciding om it locally)
So definitely not a lazy solution by default me thinks :cool:
/Jurjen
 
Last edited:

oracacle

Senior Member
It would vary for each apllication. Comparing something? maybe not. Depending on the controller you want to use, you maybe end up with nearly as many external parts, spacially if it analoge signals. Need an envelope follower with a clean output, I think good old fashioned circuit would be best.
For things like sequencing, it makes more sense, you could have multiple sequences programmed and have the master tell it what sequence to use.

The bigger question is what would need such a thing. Since moving to other MCU systems I have found that my programming abilies have improved drastically unlocking a lot of potential. I was able to control 300+ RGB LEDs, a small LED display, and have the user input not interfere with the operation of either. And that didn't even use interrupts. And that system is scalable up to potentially over 1000 RGB LEDs, providing the controller has enough memory.

The unfortanate thing is running into the limitations of the controller system you choose to use. PICAXE can only have one interrupt service routine. so if you want a timer interrrupt, and an interrupt from one of the pins, you have to determine what caused the interrupr within the ISR itself. Then think about the multitude of interrupts that can be used, timers, pins, comparitor, i2c, serial - and I am sure there are others.

Is it lazy? Yes and no. There is such a thing as lazy coding, with the correct code I would think it would be quite rare to need more than one controller.

Is it inonovative? Almost certainly not. As an idea when I was doing my A levels 20 years ago, I used a 28A and a 08. The 08 had the job of counting the number of times a rain water bucket tipped and would then send that back to the 28A when it asked for it. The 28A would spend the rest of its time doing other things like measuing wind speed, tempurature, wind direction, checking the time and recording all the results onto a set of eeproms. Now I could do that with a single 28X2 with additional functions and space to spare.

Another example, I built a project with a load of user input, a bunch of LEDs and a motor. The motor I planned on using didn't work out. I had some unpolar steppers motors but not enough pins to drive them. Using just one pin from the master, I was able to use an ATtiny 13 to control the stepper motors speed and direction. Now bare in mind that the ATtiny 13 doesn't have SPI, I2C or UART and was not about to start bit banging stuff.
 

Flenser

Senior Member
She asked me if its considered lazy or innovative to use multiple microcontrollers in a system to eliminate hardware where possible
More hardware does cost more money but it also costs money to write software and the more complex the software the greater the cost. This would be both the cost to write the original software and the cost to fix bugs, where more complex software could be expected to have more bugs.

- Writing the software is a one off cost so if you are shipping millions of the product then I expect it could work out that your cost per piece is less if you don't use multiple microcontrollers. This especially applies if you have designed your product so that the software can be updated remotely or by downloading an updated firmware image.
- Microcontrollers only cost a few $ each while software engineers get paid a good salary wnr if you are only making a few 10's or 100's of your product then saving a few 100's of $'s will only pay for a couple of hours of software development. So it could easily be cheaper to use multiple microcontrollers, especially if the software for each microcontrollers is quicker to write because it is simpler. If you develop many different products than you might also be able to re-use some of the programs for future products. i.e. once you have the software for using a PICAXE to simulate the function of a sequencing 4017 then the software development cost to re-use it in a hypothetical future product is zero.

So my answer is that this is a cost optimization exercise.
- For commercial products the cost per piece is in dollars and this will effect how much profit the company makes over the life of the product.
- For hobby products our labour is "free" in that it doesn't cost us any hard currency but I think it can be argued that the cost optimization exercise still applies. For example if it takes you much longer to write the software to run on a single microcontoller than to use multiple microcontrollers is it worth it to you to pay the extra few $ for an extra microcontoller so that you can use your project sooner or is it more important to you that the hardware $ cost is the lowest possible even though it means more work and having to wait longer before you can use it?
 

hippy

Technical Support
Staff member
She asked me if its considered lazy or innovative to use multiple microcontrollers in a system to eliminate hardware where possible (where a single device would not suffice). For example, using a PICAXE to simulate the function of a sequencing 4017 eliminating the need for external oscillator and making it infinitely adaptable or replacing a comparator circuit eliminating multiple components all of which would be part of a single circuit.
Not innovative, and something I have often recommended to simplify the design of a system or the coding. It can be a smart move to use the flexibility a programmable chip can offer or to better modularise a design.

In fact, the PICAXE is well placed for doing simple things as suggested. Though it needs to be programmed that's usually simple if it's doing a rather straight forward task, and being simple means it should be pretty easy to debug.

Replacing a 4017 or comparator is an ideal task assuming it meets the spec required. It can then save effort in the main controller as that can simply read an input, not have to do what the 'smart peripheral' is doing. That can also get around some tricky problems as well; especially if it has to wait or delay where that can otherwise be difficult to integrate into the main software.

The downside is extra cost and extra board space, though sometimes not, and that can be offset by saving time, effort and cost of coding and debugging.

For a DIY or maker project, some extra expense isn't usually excessive and can be considered as spread across the expected life of the project. An extra £5 up front can feel like a lot but spread over a year it's less than 10p a week, and you'll soon forget it was spent, and that even applies to larger amounts.
 

erco

Senior Member
Horses for courses. Micros are cheap and flexible these days, many people automatically reach for a micro for every application, which can be a mixed blessing. I love micros and I also appreciate a good hardware solution, it's getting to be a lost art to recognize the "right" application for a particular chip.

For example, I made this simple line follower using a 555 timer, two photocells and not much more. That 50-year-old analog chip drives two motors directly. Minimal parts count makes sense. Some would say lazy, some would say innovative.

 

Bill.b

Senior Member
This is a schematic of my multi function robot car. It uses 6 picaxe controllers for the various functions.

1. The 40x2 is the main controller of most of the sensors and motor control.
2. 14M2 to control the programable RGB LEDS.
3. 14m2 to control the voice (MP3 module).
4. 14m2 to input additional sensors as there were no more pin on the 40X2.
5. 14M2 for the OLED display
6. 08M2 to control the video camera and the pan and tilt servos.
All processors use serial comms from or to the 40X2

25565

Bill
 

Tvmender

Active member
Thanks for the replies all, its very helpful!

She is now putting her assignment together to include this.
 

Goeytex

Senior Member
She asked me if its considered lazy or innovative to use multiple microcontrollers in a system to eliminate hardware where possible (where a single device would not suffice).
This question constitutes a "false dilemma". A false dilemma is an informal logical fallacy where the options are erroneously limited. In other words, one of the proposed options must be true and the other false, when in fact there are other possible options. In this case it could be that neither of the options is true.

I can think of cases where dropping in a second microcontroller is simply expedient. I can think of others where it is necessary, and others where it may just be convenient or even just fun. I am sure there are other options as well.

Definition - False Dilemma
 

lbenson

Senior Member
Wow, Bill--shows your customary ability to pack a lot in. I recognize many components, but what type are the motors, and what are the 5 modules with the blue led?
 

The bear

Senior Member
Bill.b,
Brilliant.
If I had to assemble all that stuff, the Robotcar would be the size of a Fiat 500
 

Bill.b

Senior Member
Wow, Bill--shows your customary ability to pack a lot in. I recognize many components, but what type are the motors, and what are the 5 modules with the blue led?
The five IR modules on the underside are for the line follower mode.
The motors came in a robot car kit from banggood some 10 years ago.

Bill
 
Last edited:
Top