build your very own Lebowski controller !

Electric Motors and Controllers
Pinski1
1 µW
1 µW
Posts: 2
Joined: Oct 23, 2017 5:53 pm
Location: United Kingdom

Re: build your very own Lebowski controller !

Post by Pinski1 » Oct 23, 2017 5:57 pm

Hi,

I've been using VESCs to control 6kW BLDC motors but have had to current limit the motors quite severely to avoid damaging the VESCs. I've been planning to make my own and was wondering if a Lebowski MCU would work?

I'd want:
bidirectional control
control via PPM, also known as servo signals.
high startup torque.

My motors do have hall sensors built in.

Which chip would suit me best and how much would it be to the UK?

Thanks!

User avatar
Lebowski
1 GW
1 GW
Posts: 3200
Joined: Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: build your very own Lebowski controller !

Post by Lebowski » Oct 24, 2017 10:40 am

My chip does not take PPM, you would need to translate this somehow to an analog throttle signal and a forward/reverse signal.

Pinski1
1 µW
1 µW
Posts: 2
Joined: Oct 23, 2017 5:53 pm
Location: United Kingdom

Re: build your very own Lebowski controller !

Post by Pinski1 » Oct 24, 2017 12:56 pm

Lebowski wrote:My chip does not take PPM, you would need to translate this somehow to an analog throttle signal and a forward/reverse signal.
That wouldn't be the hardest thing to do, nothing like driving the motors really.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Nov 26, 2017 1:59 am

Just got one of these boards, and waiting on the brain from Lebowski. Should be ordering parts in the next day or two, tho I have a few other projects that need a good amount of parts... so gonna take a while to build up my cart. I also usually prefer to order from Arrow... though they seem to have a slightly more limited selection than mouser/digikey, some times a bit tricky finding equivalent products, but I've had really good experience always with Arrow, and free overnight shipping is awesome (and 0% off the whole site right now... hopefully I get this order in before that's gone).

Do you guys think I'll be able to run a 3000w Cyclone mid drive with this? (Currently running a 20S pack, though was considering possibly trying a 24S, tho not definite)... also debating on how many fets to go with, and what kind... got a bunch of IRFB4110's laying around... but was also considering using something a bit better. I also have 20 x CSD19536KCS's that should be arriving any day now. While 20s is my current setup, it would be nice to at least support 24s, and I suppose both FETs do support 100V... and a 24s shouldn't really be charged past 100.8 (usually I prob will only charge to 80-90%... but my BMS' balance V is at 4.2V +/ .025V a cell, and is not adjustable). Seems like it may not be a bad idea to have FETs that support a little bit more than 100V... but not sure of many specific ones that are recommended... other than the IRFB4115... but I'm pretty sure the CSD19536KCS's are better FETs overall. As for how many, I kinda want to run the max, 24... though I'm guessing 18 would likely be more than enough. Is there any harm in having "too many?. I'd like the controlelr to be able to handle a pretty high amperage... nothing totally insane, but would be nice if it could at least handle 100A, even if I'm most likely gonna be running something close to 60A max.

I'm also planning on building some SMD Lebowski controllers, though need to do some more research, as well as figure out a good project for them. While I currently have a 3000W Cyclone, I've been admiring those pretty serious RC builds. I'm thinking maybe even trying an Astro 3220, but need to figure the mount and the reduction (likely 2 stage) designs. Would a Lebowski controller be a good fit for one of those?.. any recommendations what variation to go with... was planning to try bobc's SMD variation... but not sure what to mate that with to handle the power.

And lastly, on a slightly different topic... Are there any good DIY BMS designs around?... Seems like they should be drastically easier to design (compared to a controller like this), plus I've been wanting to get a good BMS that I could adjust some of the settings. Just ordered a few 24S HCX-D131's from bestechpower... but they are not adjustable (no 'smart' features at all). They did not have any smart controller's available a month or so ago when I ordered... and I was told that a comparable controller to what I ordered, but with smart features (and prob a bit better than I ordered), would cost something like $175 each. And for those familiar with bestechpower, I don't know of any good resellers, and ordering directly from them requires a min of 2 of each item, and when you add shipping and other fees, it ends up being A LOT more than the original cost. Just to get my hands on 1 smart controller, I'd need to order 2, and it would come to over $400... at the minimum, if the piece I was quoted was accurate. I figure a BMS is relatively straight forward... and was hoping there was a good design that is Open Source/Open Hardware. I don't know of any... but if I could find one, and it didn't already have smart functionality... I would love to redesign it to include an ESP32... and designing the interface for the smart features is something I can do very easily (and a hell of a lot cleaner than all the Chinese apps I've seen), I just don't want to have to design the electronics myself... that I am not as good at. Anyone aware of any?... and/or... anyone interested in teaming up on hopefully improving one... if not, designing a complete one to release OS/OH.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Nov 26, 2017 4:19 am

I'm having trouble creating the BOM. I opened the project in kicad, opening the schematic... got a few errors, file being out of date with a few references that needed updating.... seems like clicking OK fixed the out of date references... but also got errors when trying to create the BOM, more errors about libraries being missing, I believe it said something about the "special" library that was not found. I running ubuntu, relatively fresh install on a chromebook. Anyone else run into these kind of errors with this project?... know how to fix it?

Otherwise, can anyone post (or link) me to an accurate BOM?

whereswally606
100 kW
100 kW
Posts: 1197
Joined: Jun 19, 2011 2:11 pm
Location: Cheshire, UK

Re: build your very own Lebowski controller !

Post by whereswally606 » Nov 27, 2017 7:00 am

https://drive.google.com/open?id=1CwphQ ... 9nI8LoCpit

not all my work, this is emgees bulk buy spread sheet but i found it very useful + handy pics to place the components on the boards right.
Distributing "Lebowski" FOC Controller PCB (Through hole) since 2016
Moped: Emax 110s 2009

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Nov 27, 2017 10:27 am

Thank you... I def do need to figure out this kicad stuff as well... I would like to actually use it to make something in the near future... but this will help for now.

I must say, the way the positive/negative batery connections are done, with 2 sheets of copper literally sandwiched together with an insulator seems really strange... tho apparently it's for a very good reason... it's pretty funny that I don't remember anything like that being taught when I got my engineering degree... really wasn't taught much at all when it came to the real world... I think a large amount of undergrads get am EE degree without even knowing how to do basic soldering at this point. But this kind of design really interests me... I might be able to build a logic circuit with equations based on an ideal world... but this kind of stuff is way beyond me. Probably completely due to the fact that I never actually worked as an Electrical engineer... and the amount you can learn of practical knowledge in a few weeks, let alone months/years at a job is incredible. Lebowski, I can only assume you have a number of years under your belt of actually designing/building useful electronics (whether solely as a hobby, or as a profession)... I'd be very confused if you didn't.

User avatar
Lebowski
1 GW
1 GW
Posts: 3200
Joined: Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: build your very own Lebowski controller !

Post by Lebowski » Nov 27, 2017 12:42 pm

I'm an analog mixed signal IC design engineer (22 years now). To give some examples, for work once I designed the receive ADC in a mobile phone. Also once build a complete audio path, digital 16bit in headphone out, over 103dB dynamic range, also for mobile phone.
Since it is IC design, this means everything is done using individual (on chip) transistors. So at a certain point you're looking at a 3000 transistor schematic, which then also needs to be converted to layout. Making a layout is like doing a 12 metal layer PCB connecting those 3000 transistors, all done by hand. When i started the transistors were 0.5 micro meter in size, now I am doing 15 nano meter transistors...
A large part of the work is knowing about signal processing and control loops, which came in handy building the controller IC program.
Hobby w8se, I used to build 500W tube transmitters for my Ham radio hobby, but stopped that a long time ago. Ive always liked assembly programming, wanted something complex to program, so got involved with motor controllers.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Nov 27, 2017 2:07 pm

Well... that is pretty close to where I had you pegged at. I somehow managed to get a CoE undergrad degree a few years back (at my school, CoE is literally 2-4 classes different than EE over the 4 years). I had done work on websites for a few years before school, and got somewhat bored and had taken some time off, including the whole time at school. Sadly, I am a truly horrific student (very few people are as bad of a student as I am and still get a degree, not sure how I did, nor did I really deserve it). I pretty much hated the work at school... even the enjoyable/interesting stuff just got destroyed by many different factors, and never really enjoyed all the calculus (much more of a discrete math kind of mind)... got out of school... after a few months of enjoying doing nothing, and a month of a few interviews where I barely knew shit... brushed back up on website work... a month later, had a good job. Luckily, every since then the technology has grown rapidly with what you can do on the web, and has surprisingly kept my interest, I now specialize in web based data visualization... and def not half bad at my work ;)

But... about a year ago, bought a 3D printer kit... built it... upgraded it many a time... then designed and built a couple of my own out of much heavier duty parts. Moved on to an ebike project, among other small things. What I realized was, when it's not school/work... I do enjoy electronics. On top of that... when it's projects of my own choosing, and there's a reward at the end... much more fun. So, slowly getting my feet wetter and wetter... and some of the limited amount I learned at school is coming back to me a bit... technically wasn't half bad at digital system design... and at least at a beginner level, was capable with VHDL and Verilog (though, if my work doesn't make it obvious, usually enjoy much more abstracted from the hardware languages... but it can be fun at times to go down to that level of coding). Hopefully I'll keep things going and just progress with whatever project I'm interested in next... tho I couldn't imagine it ever being more than a hobby... but so far it's a fun one. Building a couple of your controllers should be an interesting next step... def got a but to learn about all the functionality, and what not... but def seems like a logical progression with what I have been working on.

whereswally606
100 kW
100 kW
Posts: 1197
Joined: Jun 19, 2011 2:11 pm
Location: Cheshire, UK

Re: build your very own Lebowski controller !

Post by whereswally606 » Nov 30, 2017 5:57 am

Ive been having talks with Bas via private messaging about the possibility of him designing a powerboard to interface with bobc brain board. the initial design Bas sent as a quick sketch on a piece of paper (pic of). So using work id done in sketchup8 already on the original Lebowski board and other power stack projects that id envisaged to work with bobc before he'd passed on, I have produced a 3d mockup of what a Lebowski through hole power stack board might look like. He said post something in his thread a few days ago but ive been pretty ill with cold. Not sure whether he even meant this thread but he can always cross link it to where he wants with a quote.
3d mockup of lebowski proposed board2.png
3d mockup of lebowski proposed board2.png (81.41 KiB) Viewed 744 times
I think we could get it smaller with smd parts but then it loses the home gamer/diy with modest tools approach.
I also think this may not be the final iteration of design for placement of parts but its Bas' first draft, fairly closely followed.
Distributing "Lebowski" FOC Controller PCB (Through hole) since 2016
Moped: Emax 110s 2009

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 13, 2018 12:45 pm

So, I got the Power Supply portion of the original through hole board pretty much complete... BUT I still need to program the PIC12F617... I have a MiniPro TL866A universal programmer, which should be able to program the chip. But I have 2 issues. First off, the PIC12F617 is not listed in the GUI's dropdown of chips (but the PIC12F615 among a ton of other similar chips are listed)....

I tried selecting the PIC12F615, then selected "Ignore ID" (hoped that would account for the different version), then the hex file from the download.... but when I go to program I get this error "Incorrect file size 680 (needed 2048)".

I know it's a gamble selected the 12F615 instead of the correct 12F617 which I don't see as available... but was hoping it would be similar enough to work. I'm hoping that things will work if I can just get past this error.

Anyone have experience with the MiniPro... or have any advice on how to get around this error? (or if there is a better way to program the chip with this programmer)

EDIT: I tried running programming ignoring the file size, it programmed.. but then verification failed (I suppose no surprise)... I got "Verification failed at 0x00: 0x3a != 0x00"

For all I know it's jsut a matter of "0 padding" the file... but I really don't know what I am doing here... guess i should have bought a pickit 3 instead of a minipro.. prob would have been easier... but I figured the MiniPro should be able to handle programming this chip, plus many more.

User avatar
Lebowski
1 GW
1 GW
Posts: 3200
Joined: Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: build your very own Lebowski controller !

Post by Lebowski » Jan 13, 2018 2:48 pm

According to the datasheet the 617 has double the rom and ram of the 615, but i think otherwise they are the same (so same signal sequence from the programmer).

Maybe your universal programmer comes with a human readable settings file for each chip ? Maybe you can edit the file for the 615 and just double the memory ? (the 617 has 2048 words of rom and 128 bytes of ram)

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 13, 2018 2:59 pm

I'll see if I can figure that out... BUT I have a feeling I will still get the same error from the hex file... I'm guessing the hex file needs to be '0 padded' or something like that, to match the file size. I could be wrong, but my gut says it's something like that.

EDIT: I found the file with the list of devices/settings... here's the entry for the PIC12F615:

{
.name = "PIC12F615",
.protocol_id = 0x63,
.variant = 0xb3,
.read_buffer_size = 0x80,
.write_buffer_size = 0x20,
.code_memory_size = 0x800,
.data_memory_size = 0x00,
.data_memory2_size = 0x00,
.chip_id = 0x00,
.chip_id_bytes_count = 0x02,
.opts1 = 0x00,
.opts2 = 0x00,
.opts3 = 0x39,
.opts4 = 0x1102330,
.package_details = 0x8000200,
.write_unlock = 0xcf,
},

Guess I just need to adjust some of the size values... shouldn't be too hard to look at the difference in values between the 615 and 617 and adjust... will take me a little while to double check my work and convert the values to hex. BUT, I still expect that the .hex file will need to be adjusted to the correct size...

EDIT2: Here's the entry for the PIC16F616 (Which according to this page, has the same flash/RAM as the 12F617... double the 12F615)

{
.name = "PIC16F616",
.protocol_id = 0x63,
.variant = 0x23,
.read_buffer_size = 0x80,
.write_buffer_size = 0x20,
.code_memory_size = 0x1000,
.data_memory_size = 0x00,
.data_memory2_size = 0x00,
.chip_id = 0x00,
.chip_id_bytes_count = 0x02,
.opts1 = 0x00,
.opts2 = 0x00,
.opts3 = 0x3a,
.opts4 = 0x1102330,
.package_details = 0xe000200,
.write_unlock = 0x01,
},

So the code memory size is double... seems liek the memory sizes are omitted and not required... I'm not sure what "opt3" is.. they differ, tho opt1, opt2, opt4 are the same. Package details and write unlock appear to be different... I'm thinking it makes more sense to use the PIC12F615... so at least my initial guess is to simply copy the PIC12F615, and change the name and "code_memory_size"... leaving the rest the same. I'll try that... but still expecting the hex file is the wrong size.... I was reading this issue: https://github.com/vdudouyt/minipro/issues/26 and it appears people are using "hex2bin" to essentially do the '0 padding' I'm thinking may be necessary.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 13, 2018 3:34 pm

So, did what I said above... made an entry for PIC12F617 by copying the PIC12F615 and editing the code_memory_size to '0x1000'.... and when trying to program, I get almost he same error... except (and to no surprise) instead of "incorrect file size 680 (needed 2048)"... I get "incorrect file size 680 (needed 4096)"

EDIT: ok, I might have gotten it, tho maybe not... I used the command line this time... and instead of calling "minipro" I called "miniprohex" (just realized it was available)... here's the output:

/usr/local/bin/miniprohex: line 122: srec_cat: command not found
Found Minipro TL866A v03.2.80
Warning: Incorrect file size: 0 (needed 4096)
Writing Code... OK
Reading Code... OK
Verification OK

Just realized it says incorrect file size "0"... So maybe I am wrong... maybe from the above error (I'll see if I can install srec_cat command and try again).... what's weird is that the verification says "OK".... tho maybe that's because nothing what written.

I'm gonna try to fix the command not found error, that should be easy enough... and try again.. hopefully I'll get good news then. Tho I have no idea how to confirm if it is indeed programmed correctly in the end.

EDIT2: OK... I feel like I am getting closer and closer.. but still not there. I installed srecord package on ubuntu to get passed the srec_cat error.... which appears to succeed.... but now I get more errors during the verification stage:

> miniprohex -p PIC12F617 -s -w dcdc_converter.X.production.hex
Found Minipro TL866A v03.2.80
Warning: Incorrect file size: 16400 (needed 4096)
Writing Code... OK
Reading Code... OK
*** Error in `minipro': double free or corruption (!prev): 0x0000000002513d40 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x78139e3af7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x78139e3b837a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x78139e3bc53c]
minipro[0x403e1a]
minipro[0x4041f7]
minipro[0x404578]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x78139e358830]
minipro[0x4014b9]
======= Memory map: ========
00400000-00433000 r-xp 00000000 b3:01 411367 /usr/local/bin/minipro
00632000-00633000 r--p 00032000 b3:01 411367 /usr/local/bin/minipro
00633000-0072c000 rw-p 00033000 b3:01 411367 /usr/local/bin/minipro
024f5000-02534000 rw-p 00000000 00:00 0 [heap]
781398000000-781398021000 rw-p 00000000 00:00 0
781398021000-78139c000000 ---p 00000000 00:00 0
78139d4fc000-78139d512000 r-xp 00000000 b3:01 264455 /lib/x86_64-linux-gnu/libgcc_s.so.1
78139d512000-78139d711000 ---p 00016000 b3:01 264455 /lib/x86_64-linux-gnu/libgcc_s.so.1
78139d711000-78139d712000 rw-p 00015000 b3:01 264455 /lib/x86_64-linux-gnu/libgcc_s.so.1
78139d712000-78139d713000 ---p 00000000 00:00 0
78139d713000-78139df13000 rw-p 00000000 00:00 0 [stack:6172]
78139df13000-78139df1a000 r-xp 00000000 b3:01 263125 /lib/x86_64-linux-gnu/librt-2.23.so
78139df1a000-78139e119000 ---p 00007000 b3:01 263125 /lib/x86_64-linux-gnu/librt-2.23.so
78139e119000-78139e11a000 r--p 00006000 b3:01 263125 /lib/x86_64-linux-gnu/librt-2.23.so
78139e11a000-78139e11b000 rw-p 00007000 b3:01 263125 /lib/x86_64-linux-gnu/librt-2.23.so
78139e11b000-78139e133000 r-xp 00000000 b3:01 263116 /lib/x86_64-linux-gnu/libpthread-2.23.so
78139e133000-78139e332000 ---p 00018000 b3:01 263116 /lib/x86_64-linux-gnu/libpthread-2.23.so
78139e332000-78139e333000 r--p 00017000 b3:01 263116 /lib/x86_64-linux-gnu/libpthread-2.23.so
78139e333000-78139e334000 rw-p 00018000 b3:01 263116 /lib/x86_64-linux-gnu/libpthread-2.23.so
78139e334000-78139e338000 rw-p 00000000 00:00 0
78139e338000-78139e4f8000 r-xp 00000000 b3:01 263241 /lib/x86_64-linux-gnu/libc-2.23.so
78139e4f8000-78139e6f8000 ---p 001c0000 b3:01 263241 /lib/x86_64-linux-gnu/libc-2.23.so
78139e6f8000-78139e6fc000 r--p 001c0000 b3:01 263241 /lib/x86_64-linux-gnu/libc-2.23.so
78139e6fc000-78139e6fe000 rw-p 001c4000 b3:01 263241 /lib/x86_64-linux-gnu/libc-2.23.so
78139e6fe000-78139e702000 rw-p 00000000 00:00 0
78139e702000-78139e719000 r-xp 00000000 b3:01 276148 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
78139e719000-78139e918000 ---p 00017000 b3:01 276148 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
78139e918000-78139e919000 r--p 00016000 b3:01 276148 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
78139e919000-78139e91a000 rw-p 00017000 b3:01 276148 /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
78139e91a000-78139e940000 r-xp 00000000 b3:01 263091 /lib/x86_64-linux-gnu/ld-2.23.so
78139eaf9000-78139eafc000 rw-p 00000000 00:00 0
78139eafc000-78139eb1a000 r-xp 00000000 b3:01 263047 /lib/x86_64-linux-gnu/libudev.so.1.6.4
78139eb1a000-78139eb1b000 r--p 0001d000 b3:01 263047 /lib/x86_64-linux-gnu/libudev.so.1.6.4
78139eb1b000-78139eb1c000 rw-p 0001e000 b3:01 263047 /lib/x86_64-linux-gnu/libudev.so.1.6.4
78139eb1c000-78139eb1d000 rw-p 00000000 00:00 0
78139eb3c000-78139eb3f000 rw-p 00000000 00:00 0
78139eb3f000-78139eb40000 r--p 00025000 b3:01 263091 /lib/x86_64-linux-gnu/ld-2.23.so
78139eb40000-78139eb41000 rw-p 00026000 b3:01 263091 /lib/x86_64-linux-gnu/ld-2.23.so
78139eb41000-78139eb42000 rw-p 00000000 00:00 0
7fff8eb15000-7fff8eb36000 rw-p 00000000 00:00 0 [stack]
7fff8eb3d000-7fff8eb3f000 r--p 00000000 00:00 0 [vvar]
7fff8eb3f000-7fff8eb41000 r-xp 00000000 00:00 0 [vdso]
/usr/local/bin/miniprohex: line 128: 6171 Aborted (core dumped) minipro $OPTS $RWOPT $RFILE

The file size went from too small to too big... not sure if I setup the "PIC12F617" wrong... or if it's something else. I'm gonna keep trying... tho if anyone can pick up anything I did that was obviously wrong, that would be great,.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 13, 2018 5:22 pm

Obviously programming the PIC is my primary concern right now... I'm somewhat stuck right now... for all I know it is actually programmed, tho the program had an error during verify (which I suppose doesn't mean the PIC wasn't programmed correctly.. tho isn't the best sign).

One other question... once I do confirm this is programmed, I need to connect my battery, measure and calculate R_5V and R_15V. Where do I connect the battery?.... is it at the top right of the board, where it says "bat + -"?

I suppose I should work on figuring out whether or not the PIC is programmed correctly... I do have a backup PIC... was tempted to try hooking up the battery and see the results.. tho maybe not the best idea on how to test the chip... just not sure what to do next.. made a decent amount of progress, but still not sure if I've succeeded, or what to do next.

EDIT: seems like this might be my best bet (unless I buy a new programmer): https://github.com/bradgrantham/hex2bin ... but I'm not sure what the correct values would be to extract the code/config to 2 bin files

EDIT2: I just "read" the "code" section of the memory of my PIC and saved it... then opened it in a hex editor, and compared it to the provided dcdc_converter hex file... they are VERY close to the same. But it seems like just a few values are consistently off... when in a hex editor comparing pairs.. the first "46" was read as "06"... then a few lines down the one labeled "000000a8" again has a valke that should be "46" but instead is "06" and a few digits away what should be "44" is "04"... later in the file there is a "41" that shows up as "01" and a "43" that should be "01"... and I think a few other "46" that are "06" in the readout. All in all, there appears to be roughly 10 hex values that are incorrect... while everything else seems right. I don't know if this is of any help at all... if anything it seems more like a tease... sooo close to being correct... but presumably if it was 1 off, it would still be wrong. Sadly, I'm not sure why it would be this close but not correct... nor how to go about correcting it.

EDIT3: OH, BTW, the error in the above post has been fixed at least... no longer getting an error from the program.. not verifying appears to work.. just confirms that the verification is failing (as should eb suspected from reading the code from the chip and comparing to the original hex)

User avatar
Lebowski
1 GW
1 GW
Posts: 3200
Joined: Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: build your very own Lebowski controller !

Post by Lebowski » Jan 14, 2018 2:20 am

Is there a way to slow down the programming clock, maybe then the code will be correct ?

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 14, 2018 6:04 am

I can't seem to figure out a way... I went through pretty much every line of code in the git repo for the linux version. I also tried fiddling with some of the values in the device definition. Sadly, other than a few minor insights I found in the available code... most of the values don't have any information on what they do... and the ones I could figure out in the code seem to be set correctly. Seems like most of the 'opts' values are relevant inside the programmer device, not the code sadly.

And thought I was onto something... I read the "almost" correct hex from the PIC... I tried editing a few hex values... then writing to the PIC. This appeared to work.. finally got a verification that succeeded. I did this a couple of times successfully... so I decided to take the readout... and edit it to match the correct hex file (with all the extra padding left as is... making the file 4096 bytes. When I wrote this... I got the exact same verification error (in other words, the first incorrect hex value is in the exact same spot) "Verification failed at 0x0d: 0x46 != 0x06" .... really disappointing... since the other edits actually wrote correctly, was really hoping this would. It also seems odd that ALL the mistakes are with 0x0* (* being 1-6) where it's supposed to be 0x4* (* being the same number)... in other words the incorrect ones are all off by 0x40.... BUT it's not like all the 0x4* values are wrong... just some. This makes me believe I have a setting just slightly off... tho I could be wrong.

nieles
10 kW
10 kW
Posts: 640
Joined: Jul 14, 2008 5:39 pm
Location: The Netherlands

Re: build your very own Lebowski controller !

Post by nieles » Jan 14, 2018 7:03 am

Hi Progrock,

its very dangerous to compare Hex files, because of the way the file is build up. two totally 'different' hex files (when comparing the ascii) can lead to the same binary file. (binary format is the raw byte information)

see if you can convert your .hex to .bin and the same for your read back file. and then compare those

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 14, 2018 10:43 am

Interesting, thanks for the info. I think I just need to pickup a pickit 3...sadly, considering I bought the TL866 specifically for this (well, the idea was to use it for this, but have a universal programmer for future use)... guess I should have been more careful when checking if the chip was supported, I saw all the PIC's that were supported, and just assumed this one would be. I'm still guessing I am just slightly away from getting it right, but I honestly have no clue what else to try, I bet I'm one small change away from having it, but I may never find that change. Hopefully it'll come in handy on something else (ironically, my other use for it so far was with an Atmega 328P... which it can theoretically program, but seems like a total pain in the ass, easier to rig up an Arduino UNO to do the job.) The other issue is, and what have actually solved my current issue with the PIC, I don't have a windows computer to use the official software, so I'm stuck with the much more limited linux version, which only has a few command line options, nothing like the original GUI from what I can tell. The only windows "computer" I have is a Windows 10 VM running on my UNRAID server. Been using it to run Fusion360 via remote desktop... which actually does work beautifully... it appears to run better using Remmina, running on my Chromebook with Ubuntu installed via crouton better than it previously ran on a new Macbook Pro. Sadly with the VM, even tho the USB programmer shows up (it's even identified correctly by name/model) in my Windows 10 VM config, where I explicitly give it access, for some reason I can't seem to get it to show up correctly from within the VM. It seems like the driver may have issues being installed in the VM (tho hard to tell at the end whether it's successful or not), but when I check the device manager, I don't see any unidentified devices, and I don't see it... plus the Minipro application says no device found. Anyway, looks like I should have grabbed at pickit 3 in the first place... I think I'll be ordering one today. One of these days I hope I have a good use for the Minipro TL866A.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 22, 2018 7:17 pm

Got my Lebowski brains in the mail the other day, and the pickit 3 should be here either today or tomorrow... hopefully I can get this guy built in the next few days, sadly I don't currently have an enclosure for it, but if I get this working, I'll be very motivated to finding one that'll work. Tempted to buy a $50 cyclone controller, if the case will fit this, then I'd have the internals as a backup to my current one, and can use the enclosure for this, haha. But step one is getting this guy working. Looking forward to building some of the SMD versions next, got a couple of SMD brains to use for them... will be interesting, and should be able to get one of those to fit an enclosure I already have (also have thousands of SMD resistors and capacitors to use... I love how you can get them conveniently in 'books', really mini binders, of all the standard values for next to nothing on ebay/aliexpress... much more convenient than the through-hole resistor kits I've had in the past).

Anyway, hopefully I'll have the power supply ready to go today/tomorrow... as long as I have the right resistors to calibrate it on hand... Then I gotta decide on how many FETs to make this controller, I'm thinking 12 or 18 (leaning towards 18). Was tempted to go all out with a 24 FET, but I think that's probably unnecessary for my use cases... with the high quality FETs I plan to use, 6 might even be enough, lol... but def planning to at least go with 12.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 22, 2018 11:02 pm

OK, took a few tries with the pickit, but looks like I finally got it successful (Had the wrong J1 jumper setting the first time I believe... then had to find a powered USB hub in order to supply the right voltage via the pickit 3 and the socket it comes with). It appears to have programmed and verified correctly. Now I need to hook up my battery and calculate the correct R_5V and R_15V.

Just so I'm sure I'm doign the right thing, I connect my battery (with a fuse) to the small 'bat + -' connectors on the top right of the board, then make the measurements to calculate the correct resistors to use to adjust the voltages to be correct?... is that right, or does the battery get connected somewhere else? (this seems like the obvious spot, just seems like a small connection for the battery... but I suppose this is just to power the board.... the real power for the ebike will be going through the FETs I believe, not the board)

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 23, 2018 1:19 am

OK, so I got everything hooked up, I connected my battery and measured the 2 voltages. My 5V measures is 4.78, and my 15v measured is 13.92. Using the provided formulas my idea R_5V = 8,812.5 Ohm and R_15V = 8,333.3 Ohm. Sadly, on hand, the closest resistors I have are 10k. I figure fir the 5v that shouldn't be too bad, should get a voltage of ~5.062, the 15v that may be a little worse, my calculations say it should give me a 14.82V. Both seem pretty close to me... but if that won't cut it, I can order some resistors that are closer to the exact values.

User avatar
Lebowski
1 GW
1 GW
Posts: 3200
Joined: Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: build your very own Lebowski controller !

Post by Lebowski » Jan 23, 2018 2:52 am

progrock wrote:
Jan 23, 2018 1:19 am
OK, so I got everything hooked up, I connected my battery and measured the 2 voltages. My 5V measures is 4.78, and my 15v measured is 13.92. Using the provided formulas my idea R_5V = 8,812.5 Ohm and R_15V = 8,333.3 Ohm. Sadly, on hand, the closest resistors I have are 10k. I figure fir the 5v that shouldn't be too bad, should get a voltage of ~5.062, the 15v that may be a little worse, my calculations say it should give me a 14.82V. Both seem pretty close to me... but if that won't cut it, I can order some resistors that are closer to the exact values.
Both voltages should be close enough with the 10K... they are not super critical, especially the 15V. For the 5V anything between 5.0 and 5.1 should do it.

progrock
100 W
100 W
Posts: 218
Joined: Oct 02, 2017 8:47 am

Re: build your very own Lebowski controller !

Post by progrock » Jan 23, 2018 10:54 am

Great, good to know, and looks like I should be good then with these. I actually just pretty much finished populating the whole PCB... setup for an 18 FET... tempted to fill it up to a 24 FET considering I have all the parts I need, tho guessing it's overkill, tho maybe can't hurt. The only thing I don't have on the board is the "TEMP", K1.... I don't know what's supposed to be plugged in there. Besides that, just need to either find a plastic screw that'll fit for this large inductor (sadly the ones i currently have are too short)... or might just epoxy/glue it down.

Next up is figuring out what to mount the FETs too... pretty sure I have something that'll work, can't wait to actually have this thing running, looking forward to comparing this thing to my stock Cyclone controller.

EDIT: Hmm, been trying to figure out the FETs setup... the 6 FET example is pretty straight forward... if I'm picturing things correctly, a 12 FET would simply have 2 FETs accomplishing the same thing as each 1 in the 6 FET (not exactly sure how that would look wired with only 3 phase wires to output).... Then an 18 FET, I suppose that would just be 3 FETs doing the same thing as each 1 FET in the 6, tho seems a little funky... The 24 FET makes a little more sense in my head... though maybe it's all the same thing. I'm still sorta confused, I think I need to draw things out, to get a better feel for this... but also trying to picture exactly how I would setup a flat piece of aluminum. I'm also thinking about moving to the 24 FET setup, I have the parts, and seems to make a little more sense in my head when it comes to organizing the FETS.

Are there any examples of how a 12 or more FET setup would look? (the PCB is pretty straight forward with the example.. I mean the FETs themselves with the 3 phase output)
Last edited by progrock on Jan 23, 2018 11:52 am, edited 1 time in total.

User avatar
Lebowski
1 GW
1 GW
Posts: 3200
Joined: Jun 28, 2011 1:38 am
Location: beautiful Zurich, Switzerland

Re: build your very own Lebowski controller !

Post by Lebowski » Jan 23, 2018 11:48 am

'TEMP' is for one or more optional temp sensors, for either in motor or controller.

The sensors are digital (DS18S20) and can be placed in parallel, the controller ic supports upto 8.

Post Reply