Notifications
Clear all

Code and Wiring for DB1 Motor Control  

Page 7 / 7

Mr Owl
(@mr-owl)
Eminent Member
Joined: 1 year ago
Posts: 35
 

@codecage @huckOhio

Following your posts right up to 30 min ago -will bookshelf them for now -you are light yrs ahead of me            I'll order the ATMega328 chips (MC DRIVER) and then at a later date maybe go with a FTDI board once I can digest what Mike is doing , Shields  later unless some are available  and you recommended I obtain one or want to send one :  I will order the KICAD like pro'; look into classes . I'll query Paul Whorter's U tube sessions ( Sounds like I'm back in school) .Thanks for the sources on the Fuses and plastic sheets

I'll get going on the hardware - software to follow with you assistance 

If I understood the 5v vs 3.5v issues correctly - you are taking the 5V  directly from the  PD going into the 2560 thru the USB port 

Don't have fuse holders - will get them  Here is a fuse question  The Fuse assortment package  GMA (5X20 )  V is 250Vmax  for loads  0.5 amp thru 20 amp  I though you had to match voltage as well as amps

Can I use these fuses?

Keep me in the loop

Mike  - Lagina winery is called Mari Vineyards . Chateau Chantal makes the wine for St Joseph . We, the parishioners, grow the grapes ( Vineyard at St Joseph ). Chantal bottles both an altar and a private label wine for us . If you have an interest I can forward info via email 

Thanks 

 


ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 2 years ago
Posts: 1025
 

@huckohio

Well, at the moment I do have the MEGA on WN connected to a USB port on my PC and I'm monitoring it via the serial port.  I also have my two Nano's connected to two additional USB ports on the PC while monitoring both of those via the serial monitor as well.  I can see the activity of the MEGA issuing requests to the Nanos one at a time, the Nanos seeing those requests and responding to them, and the MEGA seeing the responses.  Nothing really fancy.  Even if I disconnected the USB cables, and just applied power, they would be doing the same thing, I just could not "see" it happening.

I'm reviewing Episode 11 right now and will attempt to get the motor controllers to do whatver Bill has them doing in that episode.  I don't rightly remember, so it's almost like starting over at this episode.  

SteveG


ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 2 years ago
Posts: 1025
 

@mr-owl

Several items in your post, let's see if I can respond where it's understandable.

As for the fuses, they are what I'm using.  As for matching voltage and amperage, unless I'm completely wrong (and I have been a time or two) it's the amperage that's the most important.  Notice it says 250V Max!

And yes the 5V for the MEGA and for the two Nanos comes directly from the PD board. On the MEGA it must go to the USB port as the barrel connector requires a good bit more than 5V as Mike found out.  And on the MC board the 5V goes to the 5V pin (#27 I think) of the Nano and not to the Vin pin (#30) that Bill used in his first schematic of the MC board.

I'll find the source I had for the fuse holders as well as some other parts and get that to you as you proceed with your build.

And Mike is making a new PD board, so he may have one of each of the boards he has made to send you if you ask him.

I think it would have been much better to have sent your email and physical address via a PM rather than putting it in a post for the whole world to see.  That is just my opinion anyway.

SteveG


ReplyQuote
huckOhio
(@huckohio)
Estimable Member
Joined: 2 years ago
Posts: 137
 
Posted by: @codecage

@huckohio

Well, at the moment I do have the MEGA on WN connected to a USB port on my PC and I'm monitoring it via the serial port.  I also have my two Nano's connected to two additional USB ports on the PC while monitoring both of those via the serial monitor as well.  I can see the activity of the MEGA issuing requests to the Nanos one at a time, the Nanos seeing those requests and responding to them, and the MEGA seeing the responses.  Nothing really fancy.  Even if I disconnected the USB cables, and just applied power, they would be doing the same thing, I just could not "see" it happening.

I'm reviewing Episode 11 right now and will attempt to get the motor controllers to do whatver Bill has them doing in that episode.  I don't rightly remember, so it's almost like starting over at this episode.  

Well damn!  Never thought of running the two boards from different USB ports!  I guess it is hard to teach old dogs new tricks.  Thanks and that's why you don't pay for shipping.


ReplyQuote
huckOhio
(@huckohio)
Estimable Member
Joined: 2 years ago
Posts: 137
 

@mr-owl

I copied your email and address.  I would edit your post and remove that information.  


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 744
 

@huckohio

Posted by: @huckohio

@frogandtoad

Thank you for the reply.  I was using the char array because the I2C examples I found all used it.  I believe I tried using the string first, but the code bombed.  I will try removing the array size from the bracket.  I am trying to pass a command from the MEGA2560 to the DB1 motor controller board and Bill's design uses I2C buss for all communications.  If you know of better I2C examples I would appreciate any links you can provide.

Thanks again!

No problem, glad to help.

This forum was created as a place for like minded people to ask questions, and seek help from one another.  I think that rather than providing you with links to examples that may or may not be correct, it would be much more more beneficial for you to post the code you're having trouble with here on the forum, where you'll find a much better answer, especially when many people may be working on the same project having similar issues 🙂

I'm always more than happy to help members with their code, to the best of my ability.

Cheers.


ReplyQuote
huckOhio
(@huckohio)
Estimable Member
Joined: 2 years ago
Posts: 137
 

@frogandtoad

Your feedback solved the problem.  I just used empty brackets and the code ran correctly.  Thanks again.


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 744
 

@huckohio

Posted by: @huckohio

@frogandtoad

Your feedback solved the problem.  I just used empty brackets and the code ran correctly.  Thanks again.

No problem at all, it's just that without seeing your code (or anyone's for that matter), there could be other potential bugs that might cost you a lot of energy and frustration, not to mention wasted time and or money.

In the the professional programming world, it's quite common to have our code peer reviewed at preset intervals, because there is almost always something in the code that can be improved, and not necessarily seen by oneself who is too close to the work to notice.

Anyhow, good luck with the rest of your project.

Cheers.


ReplyQuote
Mr Owl
(@mr-owl)
Eminent Member
Joined: 1 year ago
Posts: 35
 

@huckohio @ codecage 

Now that I'm beyond 10 post I can use PM

Mike thanks for editing the post to delete the address

Steve- found fuse holders at Jameco- PCB Mount Fuse Block 2 Pin 5X20 mm 


ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 2 years ago
Posts: 1025
 

@mr-owl

When I looked your email and street address were still there.  I edited and deleted those lines.  As an admin I think it let me remove them.  I'll check again later to be sure they didn't magically reappear.

When you order the ATMega328 chips, be sure you are getting the chips already preloaded with the Arduino boot loader, or else you are going to have to go thru the process of burning the bootloader yourself.  Something that multiple folks here have had to stumble over.  Bill had made a statement in one of his videos that the "P" on the end of the part number indicated that they were pre-burned.  I do not think that is actually the case, but it may refer to the speed of the chip.  Initially the chip was much slower but still functioned the same, and then some speed improvements were made and the "P" was added to distinguish the newer part.  That's my story and I'm sticking to it until corrected.

SteveG


ReplyQuote
huckOhio
(@huckohio)
Estimable Member
Joined: 2 years ago
Posts: 137
 
Posted by: @mr-owl

@huckohio @ codecage 

Now that I'm beyond 10 post I can use PM

Mike thanks for editing the post to delete the address

Steve- found fuse holders at Jameco- PCB Mount Fuse Block 2 Pin 5X20 mm 

@mr-owl

I can't edit your post.  It was a poorly worded suggestion for you to go back to your post and delete your info.


ReplyQuote
Spyder
(@spyder)
Prominent Member
Joined: 2 years ago
Posts: 895
 

I'd like to re-re-restart this discussion, because it's going in a direction that I'm currently sort of headed

First, this...

 
Posted by: @byron

The steps you indicate concur with how I understand the DB1 design. Which then makes one pause to consider if this is really the best way. All the motor controller boards I possess can control 2 brushed motors, so all that is required is one motor controller board that can output the amps and volts required for the motors. Likewise only one microcontroller or SBC is all thats required to control the motor controller board, though it could easily drive more if required. (the number of pmw pins available may dictate the actual microcontroller or SBC selected for the task)

Then, this

Posted by: @byron

This is what I suggest.The navigator should know where the ship is, know where it should go, and plot a course to achieve the destination avoiding all the known rocks along the way.

The order goes out to proceed along a course. The engine room is informed to proceed and the bosun steers the steers the ship to head on the bearing given by the navigator and tweaks to tiller to keep the ship on that course.

The navigator keeps watch on the progress along the course and issues a new bearing when a waypoint is reached.

A watch crew is in place to look out for unexpected or unknown objects that may be encountered as the ship proceeds

If a watchman sights approaching danger it may be too late to wake the navigator from a slumber, the bosun must be ready to make an emergency change of course and the engine room might need to change speed. The navigator must be informed to be ready to plot a new course.

 

 

And now, where I am...

The Omnibot "works"... it's remote control only. Even tho it has ROS in it, I'm only actually using it for the camera, and the lidar. (view.rplidar makes nice pictures from it... completely useless of course, since ROS isn't actually using that data for anything)

So I decided to start again with another bot, which is my ToolBot project, and I'm at a point where I'm attempting the task of programming the thing to actually work USING ROS, instead of just having it as a nice way to make pretty radar images of my lab

I started with the same motor controller board (MDD10 RPIHat) I used in the Omnibot cuz it could control 2 heavy duty motors on a single board

In order to get this to work on the Jetson Nano, I really needed to get the PWM working (which is disabled by default. Somebody should tell you this when they're busy telling you that all 40 pins are the same as the Pi)

Then, when I got it working, I realized that having the motor controller board directly connected to the ROS computer isn't the way that ROS was meant to work...

@Byron has it nailed. It's a captain and a ship, and a whole crew

ROS Slave (which is the Jetson Nano inside the bot, which is counterintuitive to me, cuz one would think that THAT is the Master. Master is the computer you sit in front of when you give it instructions) does all the work of communications between all the parts of the bot

It works on a "publisher/subscriber" system

ROS Master says "Go to the living room" (by clicking on a place on the map)

ROS Slave then "publishes" an announcement saying "go to the living room"

My lidar is directly connected to the Jetson, so, it knows where it is without needing to ask anybody

It maps out a GENERAL path, and publishes a message saying "go to the living room"

The arduino, (which is where the motor controller SHOULD be connected, and IS now, but no longer does anything cuz it's arduino) then sends out more specific instructions to the motor controller, which then activates the motors

The motors move, and receive feedback from the encoders built into the motors, and publishes that data, which the arduino and the Slave subscribe to

Another arduino, connected to some ultrasonic sensors, constantly reads the data from the sensors and publishes the data, which the Slave subscribes to, and uses that data to alter the path accordingly to avoid furniture, walls, and any stray cats that might be roaming around

Now, even tho the lidar is active, and working, it's mounted on top of the bot, and since it's a laser, it only sees things at its height, which is useless against cats, which aren't tall enough to register to the laser

I thought about mounting it lower, but the only place would be in front, which would mean that I don't see anything behind the bot. I've since picked up an intel realsense camera, which should still only see in front, but, compensate for the height problem (I hope)

So this is where I am, and the problem I've run into...

ROS does have a set of libraries to communicate with arduino (rosserial, ros_lib, and rosserial_arduino)

(I'm using Melodic, this tutorial is for Indigo)

http://wiki.ros.org/rosserial_arduino/Tutorials/Arduino%20IDE%20Setup

There IS an arduino library for the MDD10 arduino hat

https://github.com/CytronTechnologies/Arduino_MDD10A

Which is not very helpful to me, since I'm trying to control the motors via ROS, not a potentiometer, but it's a place to start. Also, every time I try to include ros.h, I get errors that I can't seem to get past

Now, I did get the thing working via remote control using the MDD10 Pi Hat on the Jetson, so I know it functions physically, but, again, I need to use the MDD10 arduino board to get functionality from ROS and I can't find a sketch that somebody has already written for this particular board...

Which is why I'm stuck. I'm not a programmer. I can build anything (almost anyway), but I couldn't program my way out of a paper bag

Any suggestions (that don't include "learn to program" or "learn to code") would probably be useful

 

 


ReplyQuote
robotBuilder
(@robotbuilder)
Prominent Member
Joined: 2 years ago
Posts: 764
 

@spyder

I can build anything (almost anyway), but I couldn't program my way out of a paper bag

Any suggestions (that don't include "learn to program" or "learn to code") would probably be useful.

It wasn't my impression that ROS means you don't have to know how to program? If you can't program then surely you need a step by step, paint by numbers, solution? A bit like doing electronics by numbers. Connect wires between these points and voilà you have built an amplifier.

So it seems you need to find a complete step by step tutorial which includes all required code for your particular hardware? Although I can program at a low level I find high level programming too difficult and complex to learn.  I have looked at a few ROS tutorials and videos by James Bruton and realised it would take maybe forever before I could figure out how to use it.

 

 


ReplyQuote
byron
(@byron)
Reputable Member
Joined: 2 years ago
Posts: 492
 
Posted by: @spyder

@Byron has it nailed. It's a captain and a ship, and a whole crew

Ha, a small drawing pin holding a flimsy bit of paper with much waffling more like it. 😀 

I rather agree with @robotbuilder on ROS.  It could be a useful path to go down, but not without some deeper learning.  I think that James Bruton fellow said he went on a course to lean it all, and I think one has to get 'stuck in' if learning ROS rather than just using code snippets if one is going to use ROS.

Just a comment that I think your Jetson Nano could be both a ROS Master and Slave at the same time if you desire, after all it runs a multitasking linux system.

But ROS is not a path I choose to go down, and if you do figure it all out then do post a dummies guide for us to follow. 😎 

I'm not doing any electronics or robotics stuff at the moment so I don't have anything more to share on navigating or controlling a bot, but I hope to get back to it sometime later this year.


ReplyQuote
Mr Owl
(@mr-owl)
Eminent Member
Joined: 1 year ago
Posts: 35
 

@codecage @ byron @huckohio

Dronebot 1

Trying to understand where my issue is in uploading to the ATMEGA 328P-PU ( Motor Controller Board )from the FTDi.  Want to resolve before I completely switch gears and follow your direction  I believed I worked thru my other issues also  and found  loose connections ;Now I get this error  " problem uploading to the board  - connection are not crossed - the rx to tx 's okay ; Got bootloaded 328P ; Got window 10 and  It appears I have all the  FTDI drivers -see attached ; in arduino IDE Tool  use arduino UNO ,etc  Even when I run the blink program I get the error . any suggestions  before I scrap this entire strategy - At this point it is academic  just trying to find the causal factor I'll post my code error in a  " new post "under the appropriate category 

Here are some screen dumps -what concerns me is that when I go to board info with all devices  hooked up even  thought I get a com port 12 , board info states  " unknown board   0403  6001 

VCPDRIVER

 

20210419 122729
DeviecManagerBSHOWALLHIDDEN
ARDUINOTOOLJPG

ReplyQuote
Page 7 / 7