# General Advice on Micro controller circuit

#### Tim Donoghue

Joined Jan 13, 2015
7
Sorry if this questions too brief or...stupid but essentially I'm on an electrical/electronic engineering course and have never had previous experience building a circuit before. I have been requested to formulate and build a circuit of my choice and decided to go for a PIC based micro controller circuit that controls three motors dependent on a keyboard input, the only problem is I have no clue where to start. So I guess my very long winded question is are there any starting guides to these type of simple circuits and/or information on specific micro controllers and such? Any help will be much appreciated and sorry if it seems basic I'm completely new to this kind of thing.

Joined Jul 18, 2013
20,918
For someone who is starting from page 1, I wouldn't call a Picmicro 3 motor controller a 'Type of simple circuit'!
You could start with the Nigel Goodwin's Pic tutorials, they have also been translated into C if you do not go the Assembly route.
There is also the hardware to drive the motors, Mosfets etc.
http://pic-rosa.blogspot.com/2007/09/source-code-for-pic.html
http://tahmidmc.blogspot.ca/2013/01/using-high-low-side-driver-ir2110-with.html
You would also need to find a PIC with 3 PWM modules unless simple ON/OFF?
Max.

#### bertz

Joined Nov 11, 2013
327
Sorry if this questions too brief or...stupid but essentially I'm on an electrical/electronic engineering course and have never had previous experience building a circuit before. I have been requested to formulate and build a circuit of my choice and decided to go for a PIC based micro controller circuit that controls three motors dependent on a keyboard input, the only problem is I have no clue where to start. So I guess my very long winded question is are there any starting guides to these type of simple circuits and/or information on specific micro controllers and such? Any help will be much appreciated and sorry if it seems basic I'm completely new to this kind of thing.
What do you want the motors to do?
A. Start & Stop
B. Forward & Reverse
C. Speed up and slow down

Also, does it have to be keyboard control or will simple push buttons suffice?

#### Colin55

Joined Aug 27, 2015
519
"are there any starting guides to these type of simple circuits"

Yes. Build and design 100 simple projects and put them on this forum and then 100 microcontroller projects and then after that, you will be qualified to tackle the simple request you have put forward in your post.

#### AnalogKid

Joined Aug 1, 2013
8,492
That is a surprisingly specific formula for success. Does it have to be exactly 100 of each, or can he do 97 of one and 103 of the other?

ak

#### Tim Donoghue

Joined Jan 13, 2015
7
What do you want the motors to do?
A. Start & Stop
B. Forward & Reverse
C. Speed up and slow down

Also, does it have to be keyboard control or will simple push buttons suffice?
Start and stop I think would be okay, it's meant to resemble a vending machine type thing... and I really want it to have a keyboard control but if that's not possible I'll concede and use a push buttons.

#### Kermit2

Joined Feb 5, 2010
4,162
A full range PWM circuit for one motor is a daunting task for your first circuit.
I'm not an electronic newb and it took me about 20 hard hours of reading and failing just to get a pickit dev board to do the LED flashy thing.
Try building a single motor PWM controller from discreet parts to learn the basics, before using a micro to perform the PWM functions. It will not be as simple as it sounds here, now.

#### KeepItSimpleStupid

Joined Mar 4, 2014
4,104
This seems too messy for a very first project.

So, it's kinda meant to be one of those A1, A2 and A3 type of things.

If it's a vending machine, I'd actually forgo the motors and just say you would substitute an opto Triac for each AC synchonous motor.
Just make it a light, where you "turn on a motor for a certain amount of time to move a spring to dispense the product"
No need for PWM, No need for a DC motor. You could show the circuit. If you had time, you could get the opto-thingy's and use a light bulb.
Just turn on 3 different LEDs for 5 seconds each. If your into designing circuits, then you can externally multiplex. You can put it into your design, but not use it. If you had time, make it 6 LEDS, A1, A2, A4 and B1, B2 and B3. You could even go for turning on one LED total for the matrix combination.

Your going to have enough trouble multiplexing a keypad (Get a Hex keypad), displaying numbers and handling timeouts.

In effect, the keypad program and the display was a real first program in 6800 assembly language. The design of the hardware was already done for the class.

If you want a "fuller" project, then say try:
1) a 4 x 4 Matrix of LED;s and one Key of 0-F from a hex keypad
2) A 4 x 4 matrix of LED's and a two key combination. A letter and a number.

My advice is to ignore the motors They are too expensive and you don't want to go there. If you REALLY wanted to, just make one channel a motor. A 24 VAC synchonous motor would be ideal with a 24 VAC wall wart. The 311282 on this http://www.electronicsurplus.com/motors/ac-motors page would be fine. The circuitry for driving a LED and or a LED triac is virtually the same.

Other comment:
Display could be two discrete 7 segment displays. Lot's of ways.

Display could also be a serial 20x2 line display. (editied)

With a display, you can add stuff like: Sold out and price using a switch to indicate "entire amount was entered".
You could expand that to have buttons for nickels dimes quarters and dollars inserted. In software, make the sold out and price FIXED for some items.

Real fun would be to connect wireless to a webpage or via USB to a "terminal" to set prices, etc.. The door switch would disable the wireless.

Last edited:

#### GopherT

Joined Nov 23, 2012
8,012
That is a surprisingly specific formula for success. Does it have to be exactly 100 of each, or can he do 97 of one and 103 of the other?

ak
With out Colin clarifying how many significant figures are in his "100", I would have to assume anywhere from 50 to 149 would fit his requirement. But, then again, it is a Colin55 requirement so I have to wonder... Does it really mean anything at all?

#### AnalogKid

Joined Aug 1, 2013
8,492
With out Colin clarifying how many significant figures are in his "100", I would have to assume anywhere from 50 to 149 would fit his requirement. But, then again, it is a Colin55 requirement so I have to wonder... Does it really mean anything at all?
I stopped wondering two days after I joined EP.

ak

#### GopherT

Joined Nov 23, 2012
8,012
EP?

#### MrChips

Joined Oct 2, 2009
21,366
No need to ask if you have EP.

#### bertz

Joined Nov 11, 2013
327
Start and stop I think would be okay, it's meant to resemble a vending machine type thing... and I really want it to have a keyboard control but if that's not possible I'll concede and use a push buttons.
Start and stop really makes this easy. You can omit the first 99 of Colin55's projects and go right to microcontrollers. In industry microcontrollers are usually programmed using the assembler or ‘C’ programming languages. However the complexity of these languages means that it is often not realistic for younger students in education, or many home hobbyists without formal training, to use these programming methods. The PICAXE system overcomes this problem by use of a much simpler, easy to learn, BASIC programming language.

A PICAXE microcontroller is a standard Microchip PICmicro™ microcontroller that has been pre-programmed and tested with the PICAXE bootstrap code. The bootstrap code enables the PICAXE microcontroller to be re-programmed directly via a simple serial connection. This eliminates the need for an (expensive) conventional programmer, making the whole download system a very low-cost simple serial cable!

Here's the best part - you don't have to design any circuits, etch any PC boards or buy expensive programmers. It's all been done for you. That doesn't mean this is plug and play. It's not! A project like this will require about 60 to 90 days to complete which includes delivery time for parts and a learning curve for the PICAXE BASIC programming language.

Here's what you need to get started:

PICAXE-18 High Power Project Board CHI035

PICAXE-08 Proto Board AXE021

4 x 3 Matrix Array 12 Key Membrane Switch Keypad

3pcs 3V 5V 6V DC Motor Gear Motor

These are the main components for the project. You'll need some resistors and of course the processor chips. Click on each item for links to source them as well as technical information. If this piques your interest let us know and I'll show you how to get started by making a smart keypad interface.

#### AnalogKid

Joined Aug 1, 2013
8,492

#### Tim Donoghue

Joined Jan 13, 2015
7
Start and stop really makes this easy. You can omit the first 99 of Colin55's projects and go right to microcontrollers. In industry microcontrollers are usually programmed using the assembler or ‘C’ programming languages. However the complexity of these languages means that it is often not realistic for younger students in education, or many home hobbyists without formal training, to use these programming methods. The PICAXE system overcomes this problem by use of a much simpler, easy to learn, BASIC programming language.

A PICAXE microcontroller is a standard Microchip PICmicro™ microcontroller that has been pre-programmed and tested with the PICAXE bootstrap code. The bootstrap code enables the PICAXE microcontroller to be re-programmed directly via a simple serial connection. This eliminates the need for an (expensive) conventional programmer, making the whole download system a very low-cost simple serial cable!

Here's the best part - you don't have to design any circuits, etch any PC boards or buy expensive programmers. It's all been done for you. That doesn't mean this is plug and play. It's not! A project like this will require about 60 to 90 days to complete which includes delivery time for parts and a learning curve for the PICAXE BASIC programming language.

Here's what you need to get started:

PICAXE-18 High Power Project Board CHI035

PICAXE-08 Proto Board AXE021

4 x 3 Matrix Array 12 Key Membrane Switch Keypad

3pcs 3V 5V 6V DC Motor Gear Motor

These are the main components for the project. You'll need some resistors and of course the processor chips. Click on each item for links to source them as well as technical information. If this piques your interest let us know and I'll show you how to get started by making a smart keypad interface.
This is absolutely perfect and you're a saint... I would love anymore input you're willing to give, and I have a tiny tiny bit of experience on PICaxe, but have never had to do anything like this(on my own), Thanks a bunch again.

#### bertz

Joined Nov 11, 2013
327
This is absolutely perfect and you're a saint... I would love anymore input you're willing to give, and I have a tiny tiny bit of experience on PICaxe, but have never had to do anything like this(on my own), Thanks a bunch again.
OK, so let's give it a go. The first thing you need to do is order the parts I listed above as well as an 18M2 processor and a 08M2 processor. Then go to the RevEd site and start reading the manuals. DigiKey has some nice PICAXE BASIC tutorials to get you in the swing of things. You'll need some other miscellaneous parts (resistors, male header, terminal blocks), but we'll get to them later.

Here is how your project is going to work:
The PICAXE-18 project board has the capability to drive up to 4 motors. You can set it up for 3 or 4 motors, it doesn't matter - your choice.
The PICAXE-08 proto board is used as the decoder for the keypad which will plug right into it. The 08M2 will communicate with the 18M2 depending upon which key is pressed.
When the appropriate button is pushed on the keypad, the motor will run for 5 seconds and shut off. See - just like a vending machine.

It's important that you keep us posted on your progress. Otherwise if we don't hear from you we can assume you said to h__l with it and chucked the whole idea.

#### Tim Donoghue

Joined Jan 13, 2015
7
OK, so let's give it a go. The first thing you need to do is order the parts I listed above as well as an 18M2 processor and a 08M2 processor. Then go to the RevEd site and start reading the manuals. DigiKey has some nice PICAXE BASIC tutorials to get you in the swing of things. You'll need some other miscellaneous parts (resistors, male header, terminal blocks), but we'll get to them later.

Here is how your project is going to work:
The PICAXE-18 project board has the capability to drive up to 4 motors. You can set it up for 3 or 4 motors, it doesn't matter - your choice.
The PICAXE-08 proto board is used as the decoder for the keypad which will plug right into it. The 08M2 will communicate with the 18M2 depending upon which key is pressed.
When the appropriate button is pushed on the keypad, the motor will run for 5 seconds and shut off. See - just like a vending machine.

It's important that you keep us posted on your progress. Otherwise if we don't hear from you we can assume you said to h__l with it and chucked the whole idea.
I've ordered all the parts now, I will definitely keep posting any updates, hopefully my college has all the other parts. I'm going to go read through those links you gave me, and thank you to everyone who posted, I'd have had no clue where to start and now I'm slightly less full of despair about this course so thank you all.

#### Tim Donoghue

Joined Jan 13, 2015
7
OK, so let's give it a go. The first thing you need to do is order the parts I listed above as well as an 18M2 processor and a 08M2 processor. Then go to the RevEd site and start reading the manuals. DigiKey has some nice PICAXE BASIC tutorials to get you in the swing of things. You'll need some other miscellaneous parts (resistors, male header, terminal blocks), but we'll get to them later.

Here is how your project is going to work:
The PICAXE-18 project board has the capability to drive up to 4 motors. You can set it up for 3 or 4 motors, it doesn't matter - your choice.
The PICAXE-08 proto board is used as the decoder for the keypad which will plug right into it. The 08M2 will communicate with the 18M2 depending upon which key is pressed.
When the appropriate button is pushed on the keypad, the motor will run for 5 seconds and shut off. See - just like a vending machine.

It's important that you keep us posted on your progress. Otherwise if we don't hear from you we can assume you said to h__l with it and chucked the whole idea.

Sorry for replying to this thread so late and if this is frowned upon please berate me, but I've not been able to come back to this until now due to family issues. I have all the parts you mentioned and I've been trying to work on the PICAXE code, but it'd be much easier if I knew how the input works and how I'm going to connect the two boards together, thanks for all your help so far and sorry if I seemed like I gave up/didn't respond, thanks, Tim.

#### bertz

Joined Nov 11, 2013
327
Sorry for replying to this thread so late and if this is frowned upon please berate me, but I've not been able to come back to this until now due to family issues. I have all the parts you mentioned and I've been trying to work on the PICAXE code, but it'd be much easier if I knew how the input works and how I'm going to connect the two boards together, thanks for all your help so far and sorry if I seemed like I gave up/didn't respond, thanks, Tim.
What course are you taking and isn't the semester over with? How is this project related to the course you are taking? What's the time frame to complete the project?

#### dannyf

Joined Sep 13, 2015
2,197
This eliminates the need for an (expensive) conventional programmer, making the whole download system a very low-cost simple serial cable!
A typical PICKIT2 is less than $10 and a PICKIT3 is less than$20.

What you have here is a trade-off between making an one-time investment in the programmer and gaining access to a vast code base, or to make incremental investment each time you use a picaxe chip.

if you think avoiding a programmer is the way to go, an arduino would be a better choice here.