Just wanted to let you know that this is not the way it works for outputs. The command is , the IFLAGS are not separate parameters, they are bitflags in a byte. You have to do some binary to decimal math. So you have bits 0,1 and 2 reading from right to left line this (2,1,0). Those are position numbers since a bit can only hold a 1 and a 0. So if bit 1(the rightmost bit) is a 0 or a 1, it is easy since the decimal value you would enter is the same, a zero or a one. But to compute the others, the easiest way is to use the power of 2 based on the position of the bit. So 2 to the 0 power is 1, 2 the the 1st power is 2, 2 to the 2nd power is 4. So you just add those numbers together if they have a 1 in them. So 001 is 1, 010 is 2, 100 is 4.. So to set bit 0 and 2 to one, you add 1 and 4 and get 5. To set the fist two bits on, which looks like 011 to the computer, you add 1 and 2 together and get 3. You are counting in powers of two instead of powers of 10. Those 3 bits can hold 8 possible combinations of 1s and 0s. There are free online calculators in addition to the one that comes with windows that let you just turn bits on and off and it will give you the number ;)
How long of a wire run can the sensor be from the arduino? Say the ir sensor is 20 feet away from the arduino? Will it keep enough signal for the Arduino to read on that far of a run?
I think the developers at DCC-EX tested the length of leads for sensors and servos at 20 ft. also with success. Although they use a PCA9685 for the control with the Arduino. I personally kept my Arduino close to where I was using sensors and servos. I have used a 50ft+ 4 pair twisted pair telephone cable to operate Tortoise switch machines in the past. The best way to find out is to experiment to see if it will work in your case
@TomsTrainsandThings , Thanks. After asking I got to reading about using cat6 cable for extending the distance between I2C devices. Seems to be the way to go.
@@TomsTrainsandThings Yes Sir I like Train’s Specially Ho Style Sir and I am working on this system that you set up here for my very own set up and testing Sir and thank you for sharing with us
I have IR sensors and relays in this video, all 5vdc. This is an I/O sensor shield, that means any input or output that has 5vdc. The pins are clearly marked as Input or output, but they can be changed in code which I discussed in another video
So if I have a relais on pin 128 on my PCA9685 (#41) and I set it with 7 is bit 0,1,2 high. I store it in the eprom with But with what command can I set the relais?
I'd wondering how you connect the power to the DF Robot Shield and the Motor shield, to they have their own power supplies or does the sensor shield power the motor shield? Thanks
You can see the barrel connector in the video and me explaining the switch to change from the Mega power or the external power. The motor shield is powered in the same way with external power which is explained in the DCC++ videos
@@TomsTrainsandThings That's great thanks for clarifying.It was just in the video it didn't show the power connector on the motor shield th-cam.com/video/TdISgXAyiOY/w-d-xo.html. I really appreciate the reply.
Is it possible to enable WiFi using the DFROBOT ESP8266 WiFi Bee since we are already using the DF IO Shield instead of the recommended MakerFabs ESP8266 WIFI Shield?
@@TomsTrainsandThings Sorry I forgot to mention that I'm using DCC++EX but it's not on the official list. As I'm using an UNO hooked up to JMRI via USB and wanted to add both Sensors and Wi-Fi, hence my question. It's very hard to get the MakerFabs Wi-Fi shield so I wanted to check with you since you already have the DF IO shield before ordering the Mega and other shields. Thank you for replying on such an old post, really appreciated.
I just started messing with this part of DCC++, so perfectly timed :)
Glad it was helpful
Just wanted to let you know that this is not the way it works for outputs. The command is , the IFLAGS are not separate parameters, they are bitflags in a byte. You have to do some binary to decimal math. So you have bits 0,1 and 2 reading from right to left line this (2,1,0). Those are position numbers since a bit can only hold a 1 and a 0. So if bit 1(the rightmost bit) is a 0 or a 1, it is easy since the decimal value you would enter is the same, a zero or a one. But to compute the others, the easiest way is to use the power of 2 based on the position of the bit. So 2 to the 0 power is 1, 2 the the 1st power is 2, 2 to the 2nd power is 4. So you just add those numbers together if they have a 1 in them. So 001 is 1, 010 is 2, 100 is 4.. So to set bit 0 and 2 to one, you add 1 and 4 and get 5. To set the fist two bits on, which looks like 011 to the computer, you add 1 and 2 together and get 3. You are counting in powers of two instead of powers of 10. Those 3 bits can hold 8 possible combinations of 1s and 0s. There are free online calculators in addition to the one that comes with windows that let you just turn bits on and off and it will give you the number ;)
Thanks for your input! At least someone knows how to do it!
What was I think N...
OH YAH... Tom.. your the best teacher !!!
Thanks Bernard
How long of a wire run can the sensor be from the arduino? Say the ir sensor is 20 feet away from the arduino? Will it keep enough signal for the Arduino to read on that far of a run?
I think the developers at DCC-EX tested the length of leads for sensors and servos at 20 ft. also with success. Although they use a PCA9685 for the control with the Arduino.
I personally kept my Arduino close to where I was using sensors and servos. I have used a 50ft+ 4 pair twisted pair telephone cable to operate Tortoise switch machines in the past. The best way to find out is to experiment to see if it will work in your case
@TomsTrainsandThings , Thanks. After asking I got to reading about using cat6 cable for extending the distance between I2C devices. Seems to be the way to go.
My Man knows his S ah Stuff 😁👌🏼👍🏼👍🏼🙏
Thanks
@@TomsTrainsandThings Yes Sir I like Train’s Specially Ho Style Sir and I am working on this system that you set up here for my very own set up and testing Sir and thank you for sharing with us
So this board will only take IR sensors which run on 3.3v. I have a IR sensor which is 5v.
I have IR sensors and relays in this video, all 5vdc. This is an I/O sensor shield, that means any input or output that has 5vdc. The pins are clearly marked as Input or output, but they can be changed in code which I discussed in another video
So if I have a relais on pin 128 on my PCA9685 (#41) and I set it with
7 is bit 0,1,2 high. I store it in the eprom with
But with what command can I set the relais?
T= turnout, Z=relay, S=sensor. To set them in eprom, use E, this will set any sensor in. As shown at 7:15
I'd wondering how you connect the power to the DF Robot Shield and the Motor shield, to they have their own power supplies or does the sensor shield power the motor shield? Thanks
You can see the barrel connector in the video and me explaining the switch to change from the Mega power or the external power. The motor shield is powered in the same way with external power which is explained in the DCC++ videos
@@TomsTrainsandThings That's great thanks for clarifying.It was just in the video it didn't show the power connector on the motor shield th-cam.com/video/TdISgXAyiOY/w-d-xo.html. I really appreciate the reply.
Welcome to the oldtimer's club.
Been in that club for a while!
Is it possible to enable WiFi using the DFROBOT ESP8266 WiFi Bee since we are already using the DF IO Shield instead of the recommended MakerFabs ESP8266 WIFI Shield?
Not with DCC++ but you might want to check into DCC++EX to see if that is one of the compatible wifi devices
@@TomsTrainsandThings Sorry I forgot to mention that I'm using DCC++EX but it's not on the official list. As I'm using an UNO hooked up to JMRI via USB and wanted to add both Sensors and Wi-Fi, hence my question. It's very hard to get the MakerFabs Wi-Fi shield so I wanted to check with you since you already have the DF IO shield before ordering the Mega and other shields.
Thank you for replying on such an old post, really appreciated.
Video request: How to install a decoder in a railwagon to operate a feature like internal light.
Thanks Tom!
You are welcome!
Yeahhhhhh..... hmmmmmmm..... but,... right... ????????????????
Ill catch on sooner or later.
Easy as NCE. lol
'Easily add...' seriously?
Just enter the numbers and it's there!