Notifications
Clear all

Processing and Firmata

42 Posts
5 Users
0 Likes
13.2 K Views
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@pugwash

THANKS 🙂

 

cas


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

Here are a couple YouTube videos on Firmata

A short one:

A long one:

There's a whole lot more.  Just go to YouTube and type in Firmata.

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@robo-pi

Hey, thanks,

 

I'll check them out. But as someone said earlier, the python implementation appears to be very limited.

 

Best,

 

cas

 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @cas

I really like the idea of running all the code on a computer and controlling what the Arduino does from there. Effectively using the Arduino purely as a sensor interface.

Well, to address your original question.  I use an ESP8266-01 module to communicate with my Arduino boards.  I also use UDP instead of TCP because UDP is extremely simple to use and works just fine for my purposes.

The actual communication with the Arduino is done via a wired serial connection between the ESP8266 module and the Arduino.  I use simple text to communicate.  This of course requires that I also have a program on the Arduino that can understand the text I send.   So I need to write a program for the Arduino first and then upload that to the Arduino.  Then, after having done that, I can tell the Arduino what to do using my text command scheme.   You can use single letters, or entire words and I also send numbers as ASCII text and just convert to integer after receiving the text at the Arduino end.

This is how I communicate with all my robots via WiFi. WiFi is the wireless connection between the ESP8266 module and my notebook computer.  It works good for me.  It seems like a pretty simple approach.   Trust me, when I do thing you can be assured they will be simple. ?   I avoid unnecessary complications at all cost.

By the way, this method does not use the Internet.   The WiFi connection is solely between my notebook computer and the ESP8266 module.   No need to be connected to the Internet for this to work.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@robo-pi

Hi there,

Sounds nice. I'm aware of the ESP but I've never actively read about it. UDP is cool for something like you're doing.

In terms of sending text based commands, sound almost like the old Hayes command-set for controlling modems (Depending on how old you are)  🙂

And an ad-hoc wireless connection - gotta be the way to go.

 

Nice, food for thought.

 

Thanks,

 

cas


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @cas

And an ad-hoc wireless connection - gotta be the way to go.

Yes, I don't know what else is available, but for me it was the easiest and most cost effective way to facilitate a wireless communication with the Arduino.   There may be other methods that are even easier.

I'm also only using this as a sort of temporary arrangement.   Later I'll have a Raspberry Pi on the robot that communicates directly with the Arduino via a hard-wired serial port.   Of course, I'll continue to use the same text-based scheme of communications between the Pi and the Arduino.  That way I won't need to change the code on the Arduino. 

But once the Raspberry Pi is included in the system then I'll be communicating to the robot via its WiFi dongle.    So at that point I'll be telling the Raspberry Pi what to do, and the Raspberry Pi will then tell the Arduino what it needs the Arduino to do.

So it's an evolving system.   When completed I will no longer need the ESP8266 connection.   So I'm just currently using them as a stepping stone to bigger and better things to come later. ? 

In other words, the EPS8266 is just standing in for the Raspberry Pi at the moment.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@robo-pi

Hi,

Spooky coincidences or what ?

I was talking to my son a little earlier and the way we want to go is with a Pi 4. For his application, he doesn't need a Pi 4 but it's the same price as a 3 for the 1GB - why not ?

I'll see what libraries I can find (or whatever) If I can do it all with a Pi, I'll do that. If I can't do it all with a Pi, then it'll be a Pi with an Arduino nailed on 🙂

 

Best,

 

cas


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @cas

I'll see what libraries I can find (or whatever) If I can do it all with a Pi, I'll do that. If I can't do it all with a Pi, then it'll be a Pi with an Arduino nailed on ?

I'm using a combination of the Raspberry Pi and Arduino to simply free up the Raspberry Pi from having to deal with the motor controllers directly.   It's not that it wouldn't be able to do it on its own.   It's just that I like to keep things separate.   It also seems to me that there's less chance of any processing time interference this way.  The Pi can be focused entirely on high-level A.I. decisions while the Arduino is focused on the more mundane tasks.   It's kind of like putting your car on Cruse Control so you can get relief from having to control the speed and just focus on driving the car.

I even do this with the Arduino itself.  Like Bill is doing with the DB1, I too have separate motor control boards.  In my case the motor control boards are STM32 black pills.   I do this so they can better monitor the encoder information without any need to worry about interrupt conflicts.   The Arduino Mega will have other tasks it's doing associate with interrupts as well, coming from many different sensors. 

So the Arduino/STM32 systems will be dealing with all the immediate motion and navigation tasks while the Raspberry Pi can be focused entirely on the higher level sensors and decisions.  It's very much the same as Bill's architecture for DB1.

Later, I too hope to add a Jetson Nano to the mix.   But I'll just be using that to provide more information to the Raspberry Pi.   Like image recognition, etc.   The Pi could do that directly too.  But as I say, I prefer to keep the Pi free for my A.I. code.   This way the Raspberry Pi will be the actual A.I. "brain" while all the other controllers will be doing more mundane tasks. 

For me personally, trying to code everything onto one SBC would be a nightmare I'd rather not have. ? 

So I'm extremely interested in Bill's DB1 project because his ideas for processing architecture appear to be very similar to what I have in mind for my robot.   I like to keep everything modular.   It makes dealing with it so much easier.  Plus I think it actually helps the computer to run more efficiently as well.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@robo-pi

Hi,

yeah, makes perfect sense in something time critical. My son's requirement isn't time critical so I don't need to think much about architecture.

A parallel project, though, is that I'll be using mine for astrophotography. Timing has SOME importance, but only to a resolution of about two seconds - thereabouts. This is handled relatively easily with the grunt of a 4GB pi4.

I'll "conduct" the pi4 as a remote session, probably using xrdp or something.

An interesting couple of months ahead 🙂

Best,

cas 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @cas

A parallel project, though, is that I'll be using mine for astrophotography. Timing has SOME importance, but only to a resolution of about two seconds - thereabouts. This is handled relatively easily with the grunt of a 4GB pi4.

Yes two seconds is an eternity for most SBC.   Of course, even that can depend on exactly what it is you need to calculate within that two-second window.   What kind of astrophotgraphy do you do?  A gazillion years ago I had a 10" homemade Newtonian telescope.  The mirror was ground specifically for observing planets within our solar system.  Although it could still be used for taking pictures of long range objects like nebula etc.

I had to climb up a 6-foot step ladder to look into the eyepiece.   Back then I used a Minolta SRT-102 35mm camera to take the pictures.   And, of course, I would then have to wait to have the film developed.  Not like today when you can take a picture and see the results instantly.   I don't even know where those pictures are anymore.  Probably up in the attic with everything else.  Most were taken on slide film to be shown through a projector.  I'm cleaning out my attic to put a new roof on my cottage.  I'll probably run across those old slides.  Maybe even find a projector as well.  Who knows what I might find up there. 

I still have the mount for the telescope by the way.  I wonder if it's worth any money?  It was a pretty hefty mount and had the motor control for one axis only.  Just to keep things in the field of view.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@robo-pi

I've only just finished building my rig so I haven't really started yet. I'm in the testing phase.

I won't bore you with all the details but I'll be going after galaxies and nebulae. I'll do M 87 just for posterity - I mean we found our first real/confirmed proof of black holes there 🙂 

Best

cas


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @cas

I won't bore you with all the details

It's not boring to me. ? 

In some ways I wish I still had a telescope to look through.   I really enjoyed the days when I had that telescope up and running.   One of the coolest things I used to really like to observe were binary star systems where one star was blue and the other one red.   Or maybe blue and white.  The contrast between the starts was impressive through my scope.   And of course, my imagination would go into overload imagining what it would be like to be living on a planet that was revolving around one of those double star systems.  Although I'm not even sure if that's possible.  But even though a binary star system looks to be really close together in the telescope, in reality they are usually quite far apart.    So if  planet was orbiting one of the stars it most likely wouldn't be affected much by the other star.   None the less having a second star that close to a solar system would  be quite impressive in the sky I imagine.

But yeah, I'd love to see photos of your telescope.  And any astrophotography you might end up taking with it.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

@robo-pi

OK,

This side is power distribution

DSC 0056

 


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

And this side is processing and comms

DSC 0057

 


   
ReplyQuote
 cas
(@cas)
Member
Joined: 5 years ago
Posts: 19
Topic starter  

Not great pics, you might have to blow up a bit

 


   
ReplyQuote
Page 2 / 3