Jump to content

TigersharkBAS

Members
  • Posts

    534
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by TigersharkBAS

  1. Let's start to arrange the LEDs in a 4x12 pattern. The key here (and this why we made a 6x8 matrix instead of an 8x6) is to move every second column to the previous forming a column of 12 LEDS. See diagram below: Note the pink box which illustrates that the cathodes along this row are supposed to be connected to each other. Since we are upsetting the columns a little, we still need to wire these LEDs up as if they were still in the original row. The pink circles in this diagram indicate the LEDs in the first row which now have to have their cathodes connected to each other. In addition the anodes still need to connected to the Seg from their original column position. This is where it gets tricky. To make a PCB you need to begin connecting all these together making each LED is connected as per the schematic. At this point however, you could be just adding LEDs to a project box and soldering them up manually. In which case you won't have the problem of routing a PCB but you will of course have a rats nest of wires running around inside your box. My next post will show how a potential routing on a PCB will look like.
  2. Ok...documenting the next step in this process. So I have demonstrated in video how I have successfully been able to get data for the caution panel out of DCS and send it via Ethernet to a Ethernet enabled Arduino. At the time I was using a Adafruit Neopixel shield to simulate the caution panel. This of course, can't be used for the final product. So the next step is to figure out how to drive all the LEDs for a caution panel. The solution I have settled on is to use a MAX7219 LED Matrix driver to control all the LEDs. An Introduction to the Max7219 *** Sections of this text have been taken from the Max7219 Arduino page here http://playground.arduino.cc/Main/MAX72XXHardware This integrated circuit from Maxim is for driving either 64 individual Led's, or up to 8 digits of 7-segment displays. The drivers implement a SPI compatible slave interface that can be controlled from the Arduino using only 3 of the digital output pins. An extensive datasheet for the IC's is available from the Maxim homepage. The MAX7219 can drive a LED matix of 8x8 LEDs for a total of 64 LEDs. Our caution panel is a matrix of 12x4 LEDs (48 LEDs) so this chip will suit our needs. Here is a basic schematic of the setup. There are not yet any Leds in the schematic. There will be an extra section on Led wiring. Besides the MAX72XX itself and the Leds you need only 3 external components: two capacitors (C1;C2) and a resistor (RSet). The capacitors are there to supress noise signals introduced through the power-supply lines. By no means these 2 capacitors can be ommitted, as it might lead to sporadic or permanent malfunctions. These types of errors are really hard to track down. Both capacitors must be placed as near as possible to the V+ and the Gnd pins of the MAX72X19. The resistor RSet is responsible for setting an upper limit on the current that is fed into the Leds The MAX72XX has to be powered with +5V. For a single Led-matrix it is possible to use the +5V supply from the Arduino-board. If you add more than one matrix to the Arduino you will probably need an external power-supply. The first thing we need to understand is how to wire up a LED matrix and how the Max 7219 interacts with them. Wiring up a LED Matrix I plan on making a proof of concept PCB for the caution panel LED matrix. So I am going to create schematics and the PCB using a nifty tool called Fritzing. So we need 48 LEDs. The MAX7219 can control an 8x8 matrix. Wait....we need 12x4 for the caution panel. the MAX7219 can only handle 8 rows maximum. How will this work. Ah.....young grasshopper. Watch and learn. First lets figure out what kind of matrix we need without focusing too much on the 12x4 nature of the caution panel. We need to light up 48 LEDs. Which means we could use a matrix of 6x8. 6 rows and 8 columns will give us 48 LEDs. So let's wire up a LED matrix of 6x8. Why 6 rows and 8 columns and not 8 rows and 6 columns? Hopefully this will become obvious later. Here is what the schematic would look like. Drag out LEDs onto your schematic and arrange them in 6 by 8 grid. Rotate them 45 degrees to help you connect them up later. Note that the LEDs have all kinds of different names. I later went and labelled these correctly from LED1 moving down and to the right in numbering them. You have a matrix. Now lets add connections that will come from the MAX7219 and connect up the LEDs to each other. Each LED needs their anodes connected together and then to a Seg pole. Each row needs their cathodes connected and added to a Dig connection. Here we lay out the appropriate connectors above their respective row/column. And here we have wired all the LEDs up. This schematic should never change for you. It tells your PCB making software which components should be connected to which. Even if we change the physical arrangement of LEDs on a PCB, the schematic always should remain constant. This is exactly what we are going to do. We are keeping this schematic for a 6x8 matrix, but we are going to physically arrange the LEDs in a 12x4 pattern on our PCB. For the time being when we switch to PCB view our board looks like this. A 6x8 matrix of LEDs that matches our schematic. Next I will show how arrange this to simulate the caution panel.
  3. Still in its infancy and the price would need to drop drastically but this is an exciting idea and development. Quite ingenious.
  4. try here: http://forums.eagle.ru/showthread.php?t=120386
  5. Hey smirkza. DevonCustard wrote that article (I am no C# sharp expert). I'll alert him to this post and see if he can help.
  6. Man...this be some heavy duty shit Hempstead. And whilst I might be able to figure out the Arduino code the Lua part escapes me.
  7. Hempstead...this is great......but I might need some more practical examples from you. I'm not sure I'll be able to implement what you are talking about.
  8. Hey Burnsy. You need to Google DIY pcb kits. You basically iron a circuit board design printed on laser printer on a special board that is all copper. You then soak it in a solution that eats away all the copper except those tracks you laid out in your design. See here: http://www.instructables.com/id/DIY-Printed-circuit-board/ As for the diodes. The most common function of a diode is to allow an electric current to pass in one direction (called the diode's forward direction), while blocking current in the opposite direction (the reverse direction). Thus, the diode can be viewed as an electronic version of a check valve. Why exactly they are required for Bodnar boards (his latest ones do not seem to need them) I am not entirely sure. I suspect he uses them as protection devices for the main IC. They can protect against voltage spikes.
  9. OK...that saves 2 cycles of the For loop. We need a better way to process that string though. Or is this as good as it gets? Unfortunately I'm not sure if compressing the string will help as I don't think the problem is receiving the string...it is processing it....I think :helpsmilie:
  10. So gentlemen....I think this needs to be optimised. I can see 2 possible solutions: 1. Someone better at Lua than me figures out how we can send a string to the Arduino via UDP that only contains only values that are changing. or 2. We figure out a better way to pull apart the string in the Arduino code. I am not quite sure what causes the delay...whether it is the receiving of the string over UDP or the processing of it in the Arduino. Any ideas???
  11. Part 2 showing more LEDS working and the slight delay I experience. Part 3 showing that you SHOULD NOT send caution panel light info individually from DCS but stick to the "all commands in one string" method.
  12. Arduino code can be found here: https://github.com/jvanlint/UFC_CautionPanel Export Lua is as follows. Note this is not a complete set of lights yet. Just the beginnings of a prototype. Only contains 13 lights including the Master Caution. --IP address of the computer that is going to receive this Host="192.168.1.5" --And UDP port that the computer is listening on. Port=8888 --This function is called at the start of every mission function LuaExportStart() --Tell Lua we're going to use sockets package.path = package.path..";.\\LuaSocket\\?.lua" package.cpath = package.cpath..";.\\LuaSocket\\?.dll" --define the socket class socket=require("socket") --create the socket we're going to use throughout the script c=socket.udp() c:setsockname("*",0) c:setoption('broadcast',true) c:settimeout(.001) end --This function is called at the end of every mission function LuaExportStop() c:close() end function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() --This function is called every time a simulation frame finishes. We are going to put our export function here --GetDevice(0) returns the main panel from which "MOST" gauges and data can be obtained. local Device = GetDevice(0) --Get the state of 404 which is the master caution lamp local masterCaution = Device:get_argument_value(404) local engineStartCycle = Device:get_argument_value(480) local leftHydPress = Device:get_argument_value(481) local rightHydPress = Device:get_argument_value(482) local gunUnsafe = Device:get_argument_value(483) local antiskid = Device:get_argument_value(484) local leftHydRes = Device:get_argument_value(485) local rightHydRes = Device:get_argument_value(486) local oxyLow = Device:get_argument_value(487) local elevDiseng = Device:get_argument_value(488) local seatNotArmed = Device:get_argument_value(490) local bleedAirleak = Device:get_argument_value(491) local ailDisengage = Device:get_argument_value(492) --Format the data into something a little more usable local packet=string.format("*404-%d:480-%d:481-%d:482-%d:483-%d:484-%d:485-%d:486-%d:487-%d:488-%d:490-%d:491-%d:492-%d#",masterCaution, engineStartCycle, leftHydPress, rightHydPress, gunUnsafe, antiskid, leftHydRes, rightHydRes, oxyLow, elevDiseng, seatNotArmed, bleedAirleak, ailDisengage) --Finally send the data socket.try(c:sendto(packet,Host,Port)) socket.try(c:sendto(packet,"192.168.1.40",12345)) end
  13. IT might become more obvious when I post the code. They are basically markers to let my code know when to stop processing each packet. SOP = Start Of Packet (*) EOP = End Of Packet (#) PAYLOAD = the characters between SOP and EOP PACKET = SOP + PAYLOAD + EOP You might see a better way to do it in which case I am all ears :-)
  14. Thanks HMA. Yes. I am using the 5100. I will post the provisional (and unfinished) code later tonight when I get home. It isn't very complicated. Basically, I have used some of Devon Custard's work and modified an export.lua file that exports only the Master Caution and Caution Panel lights. It sends the status of all of these in a single string like this (lets assume 404 is master caution light and 405 is Seat Not Armed for this example) *404-1.0:405-1.0# The '*' means the string is beginning. The "-" separates a command (master caution) from a value (1.0 meaning ON). The ":" means a new command/value pair and the "#" means end of UDP message. I pick apart this string sequentially using some simple code I will post. Then pass each command/value pair to a case statement that turns on the appropriate light. This does require some more experimentation though. In the example in the video I was only sending 2 values from DCS to the Arduino. The Master Caution light and the Seat Not Armed light. Peformance was great. After making the video I enriched the export.lua to send a string with 13 lights. This caused a delay of about 2-3 seconds between unarming the seat and the Arduino lights activating. So the next experiment for me is to see whether it is better peformance wise to send a large string from DCS or to simply send each command/value in succession to the Arduino. I am almost certain it is the Arduino causing the bottleneck as it iterates through the string. Perhaps just being sent a pair of data in quick succession works better. Also note that the Caution Panel is a matrix of 4x12 lights. Unfortunately the NeoPixel shield will only have 8 rows for me to test with but it gets the ball rolling. Once the DCS to Arduino code is stable and working I will be connecting this to custom made LED matrix using a Max7219 and ditch the NeoPixel shield.
  15. The contents of this thread will eventually make it into the Wiki I started with Devon Custard but during the process of experimentation and for discussion purposes I have started a thread to explain the steps and process I will go through to get this going. My goal is to make a working Caution Light Panel using an Arduino Uno Ethernet variant and have DCS send data to it over the LAN (using UDP). I want this because I want to avoid the "middle man" code that so many have written to glue an Arduino to DCS. There are pros and cons to both approaches for what it is worth, this thread will capture the journey down the Ethernet only and no middle man code approach. Here is a video showing the early stages of progress. Components: Arduino Uno Arduino Uno Ethernet Shield Adafruit NeoPixel Shield
  16. Awesome work Hemp. Any chance you could make an entry in the wiki in my sig for this? Seems like useful knowledge.
  17. Check out YAWC. Yet another warthog checklist. It should still be available.
  18. Yes Dad. Wow...I had no idea these forums were so censored. Yaaaay Internet freedom!
  19. Can you explain what the issue is? I have complained already to the host but they blamed my DNS. But if it's a wider issue I will contact them again.
  20. Wow Krono....thanks for posting that. This guy is INSANE. Especially because his kids will play with it for like 2 weeks and then get bored. :-)
  21. Not exactly a home cockpit but this kinda reminded me of the pain we go through and I think it's pretty cool what this Dad did for his son. Some interesting creative techniques here as well. Enjoy! PS. Arduino is the best thing to happen to us tinkerers ever!! :lol::lol::lol: [url= ][/url]
  22. Hey Ice. C'est tres bien. Any chance we can begin putting some of your learnings into the wiki. PCBs, schematics, etc?
  23. That is very slick Icemaker!!! Nice looking pit. The CDU is just a monitor replicating the CDU screen in the sim? I am trying to do this using only an Arduino and whilst there are plenty of methods I am trying to understand which one people used. I have identified 4 possible ways. A large arduino like IceMaker used Chaining 8bit shift registers together. Using a Max7219 to multiplex as posted by Stevos. Using an Adafruit 16x8 LED Matrix Driver Backpack (HT16K33 chip) I am trying to do this with an Arduino Uno so IceMaker's method doesn't work for me. I am interested in what LEDs you used Icemaker. 3mm or 5mm? Superbright? Driving them all off 5V?
  24. I am specifically interested in how drove the 4x12 LED matrix required to light up the caution panel. I am investigating some methods but curious to see how others did it.
×
×
  • Create New...