TUTORIAL: How To Use RS-485 TTL MODBUS - Arduino Controller Module (Part 2/2 - Wire Up) Solar

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay the first thing you need to do is give the sketch and then include library and then go to manage libraries and then this will take a minute to load up but when it does go to filter your search and type in mod loss and then click on this and then go to install so it says Modbus master by dog-walker enlighten your arduino to be a Modbus master ba bla bla bla bla so in thaller and then click close and when you've done that you're ready to go so this is a bit of a mixed of code some of it I got from example some of it I had a at that did and whatever added some to it so you need to include the library of course set the data enable on the receiver and able pin out sorry pins on this and create an instance or define the class then we've got pre and post transmission they control the the driver enable and receiver enable appendix click that's high and low they're both together at the same time then in setup this is what we've got we've set the pin mode if the two pins that output books of course we want to control whether the enable on the two pins is high or low then we're digitally writing low to both pin straight away that we're setting serial communication at one more five two hundred board which is what I usually use anyway says they problem Modbus master slave ie d1 in the documentation you use it should say and you know the ID of the slave so for example if I just bring over the documentation for what I am working with you can see the idea of the controller is one by default and can be modified blah blah blah so the slave ID is one might be zero or whatever for you I don't know could be anything then callbacks to allow you know therefore a housekeeping really to make sure we leave the depends at a state that prepare it for the next call then in loop you went 8 so on find in resort Lane then we same result mean equals the node read input registers which is part of the Modbus class read the input registers and then choose the register type in the register you want to remember so 0 X which means hexadecimal 3 1 0 0 that's the register I want to read from and the 6 the amount of what they call cells if you like to read from the register so if I just get the documentation up again okay so got the documentation err and if we go down this is the register I want to read from 3 1 0 0 and you can see here 3 1 0 0 and this is register strictly 1 0 0 here so we're going to read in all these but I'm only reading first 6 so 1 2 3 4 5 6 and therefore I should be able to get the solar voltage they will occur interacting to be using the only way I could get power battery voltage and much dajin current so I'm reading from those registers or those green on this register those values and you can see every a very simple serial print PV voltage in the new get responsible for a number which is from the 1 to 6 or the 0 2 6 2 0 1 2 & 3 I'm not using because that's power and then 4 & 5 so now a contact emancipation which I just bring that up again if I can find it I've got to basically play about with the the value that comes back and divide it by 100 in order to get the real value and so I do that that and now as a delay as well so any pot all this thing every second upload this code to the Arduino you'll see what happens next okay so I just show you this map so you can see the cables plugged in then the cable those right down here and there's my laptop there and there are two pins from that eight pin ever net cable hooked into this little device from the hair you can see it plugged into the Arduino Nano as I've shown you earlier and the USB cable that goes down to my laptop and on the screen you can see if this camera will let you you can see that our various values getting read through in plan up top and you can see that it's flicking and new records are come in PB voltage PV current battery voltage and battery charge : and those values are live from this device using rs-485 on the mapa library so for those you're interested that's how to do it so thanks for watching bye you
Info
Channel: Antony Cartwright
Views: 106,350
Rating: undefined out of 5
Keywords: rs485, ttl, modbus, arduino
Id: tBw15SfmuwI
Channel Id: undefined
Length: 6min 5sec (365 seconds)
Published: Sun Jul 23 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.