Jump to content
 

SMART Power Board


SHMD

Recommended Posts

Hello Kev, the electronics will be for my scratchbuild project (when it turns into a working model, that is...)

http://www.rmweb.co.uk/community/index.php?/topic/53634-fox-walker-0-6-0st-2mm-scale/

Therefore it has to be really small and not only provide for a DCC decoder but also a stepper motor controller. I'm beginning to think it may be going too far though.

Link to post
Share on other sites

  • 2 weeks later...
  • RMweb Gold

Made it back to shanghai long enough to visit my usual PCB maker.

It was a good visit and I didn't really need my chaperone/minder. The girl asked a few questions but I answered with the “bog standard†as the answer to all questions. This, predictably, did not go down well until my 'familiar' interpreter had translated Oldham-ese into PuTongHua!

 

So, in less than 10 days I should have a set of PCBs ready for the next stage of this challenge.

 

Kev.

Link to post
Share on other sites

  • RMweb Gold

Here are the files that I have submitted for manufacture in ShangHai.

 

The CAD files, (SCH and PCB), were created using NOVRAM's DIPTRACE program, (available here :- http://www.diptrace.com/). No connection except being a very happy user.

 

I will upload the SCH and PCB files when I work out how to. (RMWeb won't let me.) But it will probably be better AFTER the design is tested and proven!

 

I think I will have to upload PDF version of the schematic so that easy viewing and printing can be done by all.

 

Kev.

post-12815-0-92142300-1336133707_thumb.png

post-12815-0-25277500-1336133850.png

post-12815-0-54154100-1336133882.png

Link to post
Share on other sites

  • 2 weeks later...

I recently made something rather like that for an AS project:

PWMtop

It only has a pair of L293D dual H-bridges, so it can't deal with as much current as yours, and isn't as fancy in terms of silkscreen and solder pads either... It's quite useful for various things.

Link to post
Share on other sites

  • RMweb Gold

I recently made something rather like that for an AS project:

 

It only has a pair of L293D dual H-bridges, so it can't deal with as much current as yours, and isn't as fancy in terms of silkscreen and solder pads either... It's quite useful for various things.

 

Hi WestCountry,

 

Neat little board you have there and, as you have found, very useful.

Limited, really, only by your imagination and the time it takes to develop the necessary code.

 

Regards,

Kev.

Link to post
Share on other sites

  • RMweb Gold

Got a phone message this morning that my PCBs were ready for me. Yipee!

Unfortunately I had just gone through security, in ShangHai PuXi airport, and could not go and pick them up. :(

 

I'm now writing this in BeiJing and have nothing to do - except work - until I get back to ShangHai and get my boards.

 

Kev.

Link to post
Share on other sites

  • RMweb Gold

Well that's officially the end of Stage 1 of my 2012 Innovation Challenge.

 

The design is now set in stone – well fibreglass and copper!

I can now proceed with next Stage of the project which is the assembly of the first prototype. :)

 

But before I start soldering bits to the PCB I need to decide how to configure the Smart Driver Board. I think I will kit the PCB out for dual 2A H-Bridge operation with a supply range of 5 to 24volts and dual software current monitoring capability. This will allow me to test/develop nearly all of the possible configurations – although initially to only half of the full current/voltage capability.

 

I should start soldering Monday as this weekend I will be a busy packing my family off back to Blighty.

 

Kev.

post-12815-0-89852300-1337424374_thumb.jpg

Link to post
Share on other sites

  • RMweb Gold

Assembling the board but ran into problems.

 

Don't spend 90p on a Soldering Iron and expect good results!

Also, don't buy random Solder and expect good results!

 

Ok, I think most of my problems were down to ROHS compliant Solder, (I call it FAT free Solder), which causes the Solder to not wet/flow/tin very well, requires a lot higher temperature, erodes Soldering Iron Bits and altogether acts like slush. I hate it.

Give me full fat Solder every day.

 

And as I had no Side Cutters with me, I used my nail clippers to cut all the component legs to length!!

 

Anyway, todays progress shown below:-

 

Kev.

post-12815-0-72592100-1337699422_thumb.jpg

Link to post
Share on other sites

This is where some fool in an office comes up with an idea to make his high salary and job seem worth will. But they actually do not know or understand what problems they cause.

 

When I was in the building trade, I was allowed to work with lead sheet lead solder all day long, for all the roofing we did. But it was dangerous for me to use lead solder at home!!!!!

Link to post
Share on other sites

  • RMweb Gold

Individual lead atoms are dangerous in your body.

Thus Lead fumes are dangerous, but accumulatively. (They just don't go away!)

Lumps of lead are only dangerous to your back or toes!

 

(Petrol is probably your biggest source of Lead - “Unleaded†is not the same as “lead freeâ€!)

 

Kev.

Link to post
Share on other sites

  • RMweb Gold

Finished soldering the rest of the bits, on the PCB, and wrote a simple test program.

 

A variation on the proverbial “Hello World!â€

(The most difficult bit, as ever, is the configuring of the PIC IC!)

 

Also, in the photo, I have assembled a range of “test†victims subjects.

 

Things are progressing well and I am very pleased.

 

Kev.

post-12815-0-09568600-1337859369_thumb.jpg

Link to post
Share on other sites

  • RMweb Gold

Attached is the MikroElektronika basic code that I used to generate the 'Hello World' message. (Not sure how this will come out!)

(Ok, I optimised it a bit and then added the displaying of an 8 bit register followed by displaying the voltages for the 3 POTs.)

 

This code is specifically for the PIC16F1847 chip. If you want to use a different IC, (AND the I/O pins match the board AND the internal peripherals are suitably mapped to the appropriate pins), THEN YOU will need to read the accompanying DATA sheet to configure the PIC correctly and then to configure the board correctly OR it just ain't gunna work!

 

There is no way around this, (apart from using the same PIC as me – which is the PIC16F1847. Which I do recommend.).

PIC ICs vary so much between each device that this will always be inevitable.

 

I do recommend the MikroElektronika compilers because a/ they are so well supported; and b/ they are free! :) The basic compiler is free to download and use as long as the resultant HEX code is less than 2k. No connection with MikroElektronika except being a very happy customer.

(Advert over.)

 

Kev.

SDB1test1.txt

Link to post
Share on other sites

  • RMweb Gold

Hi Heinz57,

 

No, I didn't use AutoCad Electrical. I used NOVARMs “DipTrace†(V2.2.0.9) Freeware Edition.

 

It's specifically for PCBs rather than Electrical.

I've used several PCB CAD packages over the years (decades!!) and I have to say that I like this one in all areas – (except, perhaps, in the Gerber output file generation. They could make it a bit more intuitive!)

 

It’s free, (for none commercial use with the only limit being a maximum number of usable pads {holes} being 300 - NOT including Via's though.), and it comes with an extensive library of components. It’s quite intuitive and the various programs all share similar program menus and styles – so it’s easy to use. There’s some really nice features but you will definitely find it easier if you’ve already used a CAD program to make PCBs before.

(When producing the output files for manufacturing, you REALLY DO need to know what you are doing and what your supplier will accept. I am very happy to advise here.)

 

DipTrace does have several "Export" options and one of them is DXF.

 

OK. Advert over, and the usual disclaimers apply with no connections except being a very happy user.

 

Kev.

Link to post
Share on other sites

Interesting, thanks for the infomation. Sounds like a good programme!

 

I mostly use EDwin, do you know of that one? Its good but it has a lot of floors. Don't think I've ever used it without shouting at it!

Link to post
Share on other sites

  • RMweb Gold

Interesting, thanks for the infomation. Sounds like a good programme!

 

I mostly use EDwin, do you know of that one? Its good but it has a lot of floors. Don't think I've ever used it without shouting at it!

 

 

Hi Hein57,

 

Sorry, never heard of Edwin before but I did look it up.

Your endorsement is hardly good but the main problem I saw was that the “evaluation licence†was only for 2 weeks – I can take that long just thinking about the orientation of 1 component!

 

DipTrace, at least, is free to use up to 300pads and – for none commercial use.

As an indication, my SMART Driver Board has 220 pads, so you can produce some quite big boards. (If you do find yourself making money then, as their licence states, they are happy for you to buy your license then – seems reasonable.)

 

Before DipTrace, I used to use Protel – the old DOS version.

Now, that program, I used to love!

 

Kev.

Link to post
Share on other sites

Having looked at the code, I must say I was surprised how much is still left to the writer to generate manually.

Particularly things like determining register settings for Baud Rate and the like, which is where many people stumble at the first hurdle when trying to work in Assembler at the binary/hex level.

Most people might expect an apparently high level language to do these kinds of calculation for you these days.

As it is, much of the Basic program syntax appears little more than conveniently worded Assembler - which is possibly a useful feature when first starting out.

Does the compiler produce an Assembler listing for the Basic? It would be interesting to see the equivalent code.

Link to post
Share on other sites

  • RMweb Gold

Having looked at the code, I must say I was surprised how much is still left to the writer to generate manually.

Particularly things like determining register settings for Baud Rate and the like, which is where many people stumble at the first hurdle when trying to work in Assembler at the binary/hex level.

Most people might expect an apparently high level language to do these kinds of calculation for you these days.

As it is, much of the Basic program syntax appears little more than conveniently worded Assembler - which is possibly a useful feature when first starting out.

Does the compiler produce an Assembler listing for the Basic? It would be interesting to see the equivalent code.

 

Hi Gordon H,

 

Thanks for your astute and perceptive observations/questions.

I will answer them very quickly in this post and in more detail in the following post.

 

Having looked at the code, I must say I was surprised how much is still left to the writer to generate manually.

I had to think about this one and I think it's down to two main reasons 1/ The MidRange PIC ICs are 'bit' intensive; and 2/ I've been writing assembler for 25 years! (8085, Z80, 8086, PIC) I think this shows itself in “my style†of code writing.

The bit manipulation can be achieved in different ways in the compiler.

 

Particularly things like determining register settings for Baud Rate and the like, which is where many people stumble at the first hurdle when trying to work in Assembler at the binary/hex level.

I agree %100. But to be fair to MikroElektronika, that is the complexity of the PIC micro showing. Their compiler has to be able to use ALL the chips made. Bits, memory, peripherals, pins ARE all over the place with EVERY single PIC IC thay make! Nightmare. The single biggest disadvantage with the PIC.

The demand on MicroChip is to cram in more and more Memory. Speed, Peripherals, etc etc, into the the next IC. With the history, and compatibility issues(sic), they are just not successfully managing this changing product.

The PIC “Memory Map†is a mess.

It is easier now – honest – before, with less timers/memory/interupts/anything really, the register setups were more frequent and complex!

(I don't know about the PIC24s, 33s or DSPs though.)

 

 

Most people might expect an apparently high level language to do these kinds of calculation for you these days.

Again, I agree. Human nature I'm afraid. “I want somebody else to do the hard work seeing as I have paid some money!â€

Again, it is a generic compiler supporting a great many different products.

I treat a high level language as a tool to develop code quickly, that is readable, but at a cost of increased memory size and program execution.

If these costs/benefits are too high, then I drop down into assembler...

 

As it is, much of the Basic program syntax appears little more than conveniently worded Assembler - which is possibly a useful feature when first starting out.

Yes, but I think this is “my style†of programming that is showing!

I am actually using the “Basic Compile†but as I was 'classically' trained as a Pascal programmer, I could, (initially), see little difference between Basic and Pascal – except for the over/ none use of the “;†syntax! I later modified my views and now think that they are ~%70 the same!!!

 

Does the compiler produce an Assembler listing for the Basic? It would be interesting to see the equivalent code.

Yes it does. I will post some in the next “long†post!

 

In summary, the compiler does little for individual IC support but does compensate by having a big library of routines that have examples and are known to work.

My style of writing code is what you are seeing.

The main benefit of the High level Language, over assembler, is :-

 

IF PB1 = NOT TRUE THEN

do_this

ELSE

do_that

END IF

 

or

 

BTFSC PORTA,PB1

CALL EFFECT_1

GOTO MAIN_05

CALL EFFECT_2

'GOTO MAIN_05 ' drop though

;

MAIN_05:

;

 

Now add lots or reverse logic, N/O or is N/C logic.

Edit it, delete it change it back but forget you were working in reverse logic and that the outputs are inverted too! ….

 

Kev.

And this was the short answer!

Link to post
Share on other sites

  • RMweb Gold

My head hurts after that last post!

So i'll just post the resultant .lst file. (I find this more useful than the pure .asm file - also available.)

 

Kev.

(Had to change the file.extension to get RMweb to upload this.)

SDB1test1_lst.txt

Link to post
Share on other sites

Sorry, never heard of Edwin before but I did look it up.

Your endorsement is hardly good but the main problem I saw was that the “evaluation licence†was only for 2 weeks – I can take that long just thinking about the orientation of 1 component!

 

It also takes about two weeks to select and place a component, the component libary is an absolute nightmate, you have to be increadibily specific otherwise it doesn't find anything.

 

DipTrace, at least, is free to use up to 300pads and – for none commercial use.

As an indication, my SMART Driver Board has 220 pads, so you can produce some quite big boards. (If you do find yourself making money then, as their licence states, they are happy for you to buy your license then – seems reasonable.)

 

300 pads is quite a few, so yeah, you can create some pretty decent circuits. What is the selection of components like? Is it quite big, and similarly is the libary easy to use?

Link to post
Share on other sites

I notice also in the Basic source code, that the SFRs are used immediately.

How does the compiler know where each Register is located inside the chip?

Is there an 'Include' file which we are not seeing?

With MPLAB in Assembler, it is usual to see a reference in the source program to an 'Include' file for the specific chip being used which contains all this low-level information.

Did you have to create one for yourself?

Link to post
Share on other sites

  • RMweb Gold

It also takes about two weeks to select and place a component, the component libary is an absolute nightmate, you have to be increadibily specific otherwise it doesn't find anything.

 

300 pads is quite a few, so yeah, you can create some pretty decent circuits. What is the selection of components like? Is it quite big, and similarly is the libary easy to use?

 

 

NOVRAMs Libraries are many and extensive giving a HUGE range of ready to use components!

Searching for components is both easy and hard!

Some libraries are specific to manufactures – ST Micro, MicroChip,etc. Others are generic – POTs, connectors,etc.

But to search for a component first select a library and then type in the component or part thereof.

Real quick and easy BUT you DO need to know who makes what!

 

300 pads is quite good and you design is usable/supportable for an unlimited time.

(Hint – You can use Via's as pads as long as you remember to specify “open vias†when generating the finished output files.)

 

The library s are easy to use once you have created your first new library and can find it again! The paths to the libraries needs to be kept on top of.

Also, don't lose sight on what you want to achieve in the library – new schematic component and PCB component, existing SCH but a new PCB, new SCH but existing PCB, etc.

I find it easiest to copy an existing component to my libraries and edit it to what I want. This, also, has the advantage that I know where all my (commonly) used parts are.

 

 

As for EDwin.

Your not “selling it†to me! :)

But in fairness, Every CAD package can be difficult or annoying depending on their style/design AND your own experiences/knowledge previously.

 

I recommend you take a look at DipTrace though.

 

Kev.

Link to post
Share on other sites

  • RMweb Gold

I notice also in the Basic source code, that the SFRs are used immediately.

How does the compiler know where each Register is located inside the chip?

Is there an 'Include' file which we are not seeing?

With MPLAB in Assembler, it is usual to see a reference in the source program to an 'Include' file for the specific chip being used which contains all this low-level information.

Did you have to create one for yourself?

 

Yes, there is an “include file†that you are not seeing. A very good one!

When starting a new project you specify which IC it is to use and at what clock speed, (for timing purposes.).

You do the same for the "config" registers too.

 

The file containing all the chip specific info, including not only register names, bits and address but it also uses the data sheet nomenclature, names, bits and (importantly) it knows the relevant bank switches.

The compiler does a truly excellent job of hiding the programmer of the “nightmare†of the PIC memory map.

 

You can create your own, I have never tried, but MikroElekronika have always been one step of me!

The down side of this very chip specific “include file†is that some register names change (evolve) as new devices come along.

 

More thought on the compiler advantages (over assembler):-

 

Readability

Loops

Branching

delay generation

Maths calculations

memory management (automatic Bank switching)

Built in routines (Bit Banging Manchester code anyone?!?)

supported interface devices

 

 

Assembler:-

 

Speed

memory usage (size)

control

 

 

Both have more advantages, obviously, but for their respective dis-advantages then just swap the two lists around! :)

 

 

I used to document every it in each register but the program became huge and unreadable.

Now for each control register I just comment the page number of the register in the data sheet pdf. That way I can just jump straight to it.

PIC16F1847 data sheet has 408 pages!!!

 

 

Kev.

post-12815-0-50731200-1338382129.png

Link to post
Share on other sites

  • RMweb Gold

I have been testing various aspect of this boards capabilities, clock, noise, ADC, serial port, I/O, timers,etc – all successfully and beyond my modest expectations.

This has pleased me no end!

Tomorrow I start applying serious amounts of power to the project. 3.5amps anyone? Calculations show that the PCB, itself, will be dissipating 0.2Watts at this power demand!!

 

The project, now, will be all software – if the power tests are OK and don't result in a small mushroom cloud! But, at least, motors will start to be controlled “intelligently†and I can see the satisfying results!

 

I have, as part of this challenge, wanted to help/encourage people to “have a goâ€.

As part of this I have tried to be as transparent as possible and to answer questions as helpfully as possible.

However, I can go one step further. I want to document my design as much as possible. At the end of this I will publish all files with full explanations.

This should, I hope, be enough to allow people with modest electronics/programming skills to “have a goâ€.

 

I admit that, initially, the PCB may appear intimidating. But if I break it down then the various building blocks just becomes like electronic “Legoâ€.

 

Feel free to ask questions.

 

Kev.

post-12815-0-89518700-1338641698_thumb.jpg

Link to post
Share on other sites

  • RMweb Gold

Well, Sunday didn't go well – but at least it did not result in a “crack†followed by a rising wisp of acrid smelling smoke!

No, the problem was, as Gordon H alluded to, was the setting of the various internal bit settings inside the PIC Micro.

 

To be fair, the Compiler would have no clue as to what “choices†I wanted to make BUT neither did I!

Randomly changing bits, and, importantly, reading more of the Data Sheet, eventually resulted in everything working as expected and required, but with very little of the day left to start applying serious amounts of power to test the power components and PCB tracks.

 

I initially tried to use the Compilers built in routines but these did not, indeed could not, select what I wanted so I did everything manually – byte by byte. This did eventually work, but now I at least know why. I think I will have another go at the Compilers way of doing things though as the benefits of readability might be worth the effort.

 

Again, Gordon H, has hit on another important point.

New, and experienced users, will find this a minefield AND WILL struggle. Novices will definitely be put off.

 

This is difficult.

You still can use the original, simple, very much less capable, PICs. But obviously everyone wants the latest power filled, memory massive, fast beasts available. Indeed it is the explosion of built in peripherals that frees up even more memory and processing time.

 

Observations over. (Rant? – No. I NEED all the extras Microchip can shoe-horn in. But there is a price!)

 

On the plus side my SDB powered, and controlled, its first DC motor – a small 5v fan. (mAmps!)

 

 

Oh well, I'll try again tomorrow.

 

Kev.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...