May 06, 2024, 07:14:30 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Controlling the FC-4+ with an Arduino

Started by robomaster-1, November 03, 2015, 10:12:10 AM

Previous topic - Next topic

JackMan

Quote from: livinlowe on January 26, 2016, 10:45:55 AM
No, half duplex ( and someone correct me if I'm wrong) means you just hook the transmit from your Adrinuo to the FC-4. The FC-4 doesn't communicate to the microcontroller.

I believe half duplex can execute RX and TX on a single conductor, but only one direction at a time. Full duplex can execute RX and TX simultaneously because it uses 2 conductors.

livinlowe

Quote from: JackMan on January 26, 2016, 03:18:24 PM
Quote from: livinlowe on January 26, 2016, 10:45:55 AM
No, half duplex ( and someone correct me if I'm wrong) means you just hook the transmit from your Adrinuo to the FC-4. The FC-4 doesn't communicate to the microcontroller.

I believe half duplex can execute RX and TX on a single conductor, but only one direction at a time. Full duplex can execute RX and TX simultaneously because it uses 2 conductors.

Oh! Okay, that makes sense.
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

To Jack's point, you only need to connect one wire. As those pins are connected on the FC-4+, anything you send on your transmit pin is being fed back into your receive pin. I made and RC-4 (old one) work and I'm not even an Arduino programmer! :)
Jon McPhalen
EFX-TEK Hollywood Office

robomaster-1

I tried testing this code and the FC4+ is not doing anything. I have checked all the board setting and everything is set correctly. I can't see what I am doing wrong. I am using a Pro Mini arduino board I have checked the secs on the board and it says that any pin can be used as to send and revive serial data. I am going to try a UNO Board.
Tim J. Lewis
Magic and Technology

JonnyMac

January 28, 2016, 05:12:41 AM #19 Last Edit: January 28, 2016, 06:02:26 AM by JonnyMac
Do you have a Prop-1 controller that you can test with?

BTW... I just noticed in you picture that the FC-4+ power switch is in the OFF position.


QuoteI am going to try a UNO Board.

You know... we provide base source code for the FC-4+ -- you could always dump the schmarschmino and code the app on your FC-4+.
Jon McPhalen
EFX-TEK Hollywood Office

robomaster-1

It was not on for the picture,but when I tested it was on when I was testing it and still it did nothing. I don't have a prop-1 but I think I got a prop-2 I am trying to look for it now. I do have a basic stamp 2 board with a breadboard on it and I could breadboard a serial connector for it to test FC4+ out. I should be able to use some of the test code in the FC4+ datasheet.  All I want it do is when a put a HI one of  four pins the corresponding channel will dime up and when LO dim down. Again thank you for your help on this.
Tim J. Lewis
Magic and Technology

JonnyMac

If you will provide a specification for the behavior you want from the system, I will happily code it in the FC-4+ for you. Are the specific features of the Arduino that you need? The only thing it has that the FC-4+ doesn't is ADC, but that's a simple circuit addition. Coding in Spin is so much easier than the Arduino's bastardization of C++. And you would eliminate connections between devices.

I spoke with a guy once who builds movie props. For a big movie he needed four of his little PIC boards all tied together. I joked with him by saying, "Oh... so you DO believe in multi-core -- you just want to do it the HARD way!" I showed him some of my code and he may start trying the Propeller.

If your project can be done inside the FC-4+ without an external processor, that is the way to go. You can always put the production code back in if you change your mind.
Jon McPhalen
EFX-TEK Hollywood Office

robomaster-1

That is what I am doing here with Arduino Boards. What I am working is a Seance Room in which you have to solve clues in order to escape out of the room. There are four effects that got to happen in the room. Each are controlled by separate micro controllers and one master micro controller that controls the others. In the case of the Lighting Controller I wanted to keep it simple I want to have it's micro controller take four digital pins and make each dim up and down the corresponding channel 1 thru 4 . I am going to us my basic stamp-2 board of education to test out the FC4+ and if that works I will get a prop-1 form you for the final version.
Tim J. Lewis
Magic and Technology

livinlowe

January 29, 2016, 12:49:20 PM #23 Last Edit: January 29, 2016, 03:40:19 PM by livinlowe
I just noticed that a lot of the earlier example programs for arduino were for the RC-4 not FC-4! lol

excuse me: Yes they are, just later in the thread. ugh, ignore me
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

Quote from: robomaster-1 on January 29, 2016, 12:02:32 PM
That is what I am doing here with Arduino Boards. What I am working is a Seance Room in which you have to solve clues in order to escape out of the room. There are four effects that got to happen in the room. Each are controlled by separate micro controllers and one master micro controller that controls the others. In the case of the Lighting Controller I wanted to keep it simple I want to have it's micro controller take four digital pins and make each dim up and down the corresponding channel 1 thru 4 . I am going to us my basic stamp-2 board of education to test out the FC4+ and if that works I will get a prop-1 form you for the final version.

The FC-4+ has an option port on it with four IO pins that are pulled-up to 3.3V (through 10K) but otherwise connect right into the Propeller. How were you intending to deal with these IO pins on your other microcontroller?
Jon McPhalen
EFX-TEK Hollywood Office

robomaster-1

I have been going through my collection of micro controllers and I found that I have a Multicore Propeller Prototyping Board and up to now I have not used it for anything, so I could use it for the board to control the FC4+. I have not worked with a propeller board before. So you would have walk through on how to use it and under my deadline it may be the way to go. My thought is to use the other processors control the FC4+ for the various lighting channels as need for the various lighting effects for the room. 
Tim J. Lewis
Magic and Technology

robomaster-1

I am wanting to try using my basic 2 board to run the FC4+ board, but it has been a while since I have used the Stamp environment so I am a little problem converting a stamp 1 program to a basic stamp 2. Here is the Stamp 1 program.
Thank You for your Help.

' =========================================================================
'
'   File....... FC-4+_Test.BS1
'   Purpose.... FC-4+ Features Test
'   Author..... JonnyMac
'   E-mail..... teamefx@efx-tek.com
'   Started....
'   Updated.... 01 SEP 2015
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Demonstration program for the FC-4+ IO Control Board.  All commands are
' sent to the FC-4+ through a serial link at 2400 baud (OT2400 baudmode).
' The use of the open baudmode allows boards to be daisy-chained for up to
' 16 fader outputs from one I/O pin.
'
' Configuration swtich settings
'  -- BR = off (2400 baud for Prop-1)
'  -- A1 = high bit of address
'  -- A0 = low bit of address
'  -- SM = off (for EFX-TEK serial mode)
'
' Command syntax: "!FC4", address, cmd {, data ... }
' -- where "address" is %00 (0) to %11 (3), or $FF (255) for all
' -- "cmd" is a single character
' -- optional "data" is one or more bytes
'
' Valid commands:
'
'   "!FC4", address, "X"
'     -- sets all channels to 0% (off)
'
'   "!FC4", address, "V"
'     -- requests version string from FC-4+
'     -- should be followed by SERIN to receive three-byte string
'     -- does not work with global address
'
'   "!FC4", address, "L", channel, level
'     -- sets "channel" (0..3) to "level" (0 to 255)
'        * channel is 0 to 3 (one), or "A" or $FF (all channels)
'
'   "!FC4", address, "L", "I", level0, level1, level2, level3
'     -- sets all channels individually
'     -- transmit up to four levels
'        * if less than 4 last byte must be followed by 50ms PAUSE
'
'   "!FC4", address, "L", "R", mask
'     -- randomize (0% to 100%) channel levels
'     -- only channels with "1" in "mask" bit are modified
'        * e.g., mask = %00000011 (only OUT0 -> OUT1 updated)
'
'   "!FC4", address, "D", channel, state
'     -- sets output (in "channel") to state.bit0
'        * channel is 0 to 3 (one), or "A" or $FF (all channels)
'
'   "!FC4", address, "D", "S", states, mask
'     -- sets select outputs(in "mask") digitially (off or on) to "states"
'     -- only channels with "1" in "mask" bit are modified
'
'   "!FC4", address, "D", "R", mask
'     -- digitally randomizes outputs (on or off)
'     -- only channels with "1" in "mask" bit are modified
'
'   "!FC4", address, "F", "L", channel, start, stop, seconds
'     -- fade channel from start to stop
'        * channel is 0 to 3 (one), or "A" or $FF (all channels)
'     -- duration of fade is seconds
'
'   "!FC4", address, "F", "M", channel, start, stop, tenths
'     -- fade channel from start to stop
'        * channel is 0 to 3 (one), or "A" or $FF (all channels)
'     -- duration of fade is tenths x 100ms
'
'   "!FC4", address, "F", "H", channel, start, stop, msLow, msHigh
'     -- fade channel from start to stop
'        * channel is 0 to 3 (one), or "A" or $FF (all channels)
'     -- duration of fade is milliseconds
'
'   "!FC4", address, "F", "X", chA, chB, tenths
'     -- cross fades from "chA" and "chB"
'     -- "chA" starts at 100%
'     -- "chB" starts at 0%
'     -- duration of fade is tenths x 100ms
'
'   "!FC4", address, "G", channel
'     -- retrieves present dimmer level of single channel (0 to 3)
'     -- should be followed by SERIN to receive level
'     -- does not work with global address
'
'   "!FC4", address, "I"
'     -- retrieves TTL inputs
'     -- should be followed by SERIN to receive inputs byte
'     -- does not work with global address
'
'
' Note: The ULN2803A interferes with serial transmission to FC-4+; remove
'       and replace with ULN2003A (7 channels), leaving P7 contacts open.


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' SETUP = out, no ULN


' -----[ Constants ]-------------------------------------------------------


' -----[ Variables ]-------------------------------------------------------

SYMBOL  id0             = B0                    ' version string
SYMBOL  id1             = B1
SYMBOL  id2             = B2

SYMBOL  ch              = B3
SYMBOL  level           = B4

SYMBOL  idx             = B5

SYMBOL  timing          = W5
SYMBOL   tmLo           =  B10
SYMBOL   tmHi           =  B11


' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 1500                                    ' let FC-4+ boot up
  SEROUT Sio, OT2400, ("!FC4", %00, "X")        ' reset FC-4+


' -----[ Program Code ]----------------------------------------------------

Main:
  SEROUT Sio, OT2400, ("!FC4", %00, "V")        ' get version
  SERIN  Sio, OT2400, id0, id1, id2

  DEBUG CLS
  DEBUG "FC-4+ Version ", #@id0, #@id1, #@id2, CR
  PAUSE 500


Test:
  ' digital control of single channel
  FOR ch = 0 TO 3
    SEROUT Sio, OT2400, ("!FC4", %00, "D", ch, 1)
    PAUSE 250
  NEXT

  FOR ch = 0 TO 3
    SEROUT Sio, OT2400, ("!FC4", %00, "D", ch, 0)
    PAUSE 250
  NEXT

  ' level randomize all outputs

  FOR idx = 1 TO 100
    SEROUT Sio, OT2400, ("!FC4", %00, "L", "R", %1111)
  NEXT

  SEROUT Sio, OT2400, ("!FC4", %00, "X")
  PAUSE 1000

  ' cross-fade from OUT0 to OUT1 in 3 seconds
  SEROUT Sio, OT2400, ("!FC4", %00, "F", "X", 0, 1, 30)

  ' cross-fade from OUT3 to OUT2 in 3 seconds
  SEROUT Sio, OT2400, ("!FC4", %00, "F", "X", 3, 2, 30)

Wait1:
  ' check status of channel 3
  ' -- wait for x-fade to finish
  SEROUT Sio, OT2400, ("!FC4",  %00, "G", 3)
  SERIN  Sio, OT2400, level
  IF level > 0 THEN Wait1


  ' cross-fade from OUT1 to OUT0 in 3 seconds
  SEROUT Sio, OT2400, ("!FC4", %00, "F", "X", 1, 0, 30)

  ' cross-fade from OUT2 to OUT3 in 3 seconds
  SEROUT Sio, OT2400, ("!FC4", %00, "F", "X", 2, 3, 30)

Wait2:
  ' check status of channel 2
  ' -- wait for x-fade to finish
  SEROUT Sio, OT2400, ("!FC4", %00, "G", 2)
  SERIN  Sio, OT2400, level
  IF level > 0 THEN Wait2
  PAUSE 500

  SEROUT Sio, OT2400, ("!FC4", $FF, "X")        ' global address
  PAUSE 500

  GOTO Test


' -----[ Subroutines ]-----------------------------------------------------


' -----[ EEPROM Data ]-----------------------------------------------------
Tim J. Lewis
Magic and Technology

JonnyMac

QuoteI have been going through my collection of micro controllers and I found that I have a Multicore Propeller Prototyping Board and up to now I have not used it for anything, so I could use it for the board to control the FC4+.

What you could do is just reprogram the FC-4+ to do what you want -- we support that (and I don't know how many times I have to say it). Why add another controller to the mix when you can do everything in one place? If you'll define what you want, I'll write the code -- your client doesn't need to know that I did it for you.
Jon McPhalen
EFX-TEK Hollywood Office

robomaster-1

I loaded the program into my board of education hooked up to the FC4+ and nothing was displayed on the debug screen. I checked the board setting and as far as I can tell everything is set right. Do I need to hook up he AC side to see this or can I see the LEDs on the board ranping up and down? Do I have a bad board?
Tim J. Lewis
Magic and Technology

JonnyMac

We test all boards before shipping, but if you want to send it back for a check you can do that. You need to call John B at the sales number and get an RMA.
Jon McPhalen
EFX-TEK Hollywood Office