smirkza Posted July 22, 2014 Posted July 22, 2014 I've tried that before and not been able to get it to work. I'll give it another go, but... Happy to say I've gone through DC's thread 3 x and on the last go I've managed to get the caution light to work! It's such a small thing, but it opens so many doors! Thanks to everyone who puts the work in the help out us coding illiterate dreamers! :thumbup: Cheers, Smirkza
TigersharkBAS Posted July 22, 2014 Author Posted July 22, 2014 Good to hear man. Good luck. 1 [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
Devon Custard Posted July 24, 2014 Posted July 24, 2014 heya, im nearly back to the land of cockpit builders, man cave is full of fridges right now and as soon as i get the wife to work out where they go im up and running. Good to see you posting this tiger. Theres an interesting divide between me and tiger. HE wants to do it all via export.lua whereas i would rather just use Gadrocs excellent helios work and then use a C# app to breakout the various udp packets. I can see why he would want to do that and its definitely a valid approach. My thoughts are this 1. Gadrocs already optimised the export of data pretty efficiently. No need to do it again 2. If i have more than 2 or 3 ethernet arduinos which i almost certainly will do its going to be an absolute arse to maintain that export.lua. 3. I can write c# interfaces that self heal broken connections, reset controls and perform startup routines in a multithreaded function outside of the export.lua and game function. Basically its a self contained balck box as far as DCS is concerned. It just needs the raw input. 4. c# is a damn sight faster when coded (multi threaded!!!) than a single threaded scripting engine. 5. The last one is the real kicker for me. Im more comfortable with writing C# than lua. Honestly i think doing as little as possible with LUA is preferable, scripting is fine but its a blunt tool compared with what you can do with a decent compiled language.
Devon Custard Posted July 24, 2014 Posted July 24, 2014 hey smirk. Looking at that error im betting its not the code, its the data youre passing into it. Can you send me your export.lua? In fact if you could zip up your project and attach to the thread ill look at it. In the meantime ill add some error checking to the code to validate the incoming data. DC
TigersharkBAS Posted August 6, 2014 Author Posted August 6, 2014 (edited) 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. Edited August 6, 2014 by TigersharkBAS [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
TigersharkBAS Posted August 6, 2014 Author Posted August 6, 2014 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. [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
TigersharkBAS Posted August 7, 2014 Author Posted August 7, 2014 (edited) Here is what a potential PCB trace (traces are the connecting paths of copper between component on the PCB) might look like. Note how the Seg and Dig pins connect to the LEDs that we shifted down to make a 12x4 matrix. Yellow traces are on the top of the PCB. Orange traces are on the bottom. Typically good practice in PCB design is to keep traces flowing horizontally on one side of the PCB and vertically on the other side. To be honest (and please feel free to discuss here) I really can't see any other way than making a PCB for a caution panel. Any other way is a path to madness and rats nest of wiring. Is this how other people have implemented a caution panel? By making a PCB they screw onto the bottom of the panel? Also... very quiet in here :-) Edited August 7, 2014 by TigersharkBAS [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
Warhog Posted August 8, 2014 Posted August 8, 2014 (edited) To be honest (and please feel free to discuss here) I really can't see any other way than making a PCB for a caution panel. Any other way is a path to madness and rats nest of wiring. Is this how other people have implemented a caution panel? By making a PCB they screw onto the bottom of the panel? First, your presentation is excellent and easy to understand. I expect the next part will deal with the 7219 chip and how that will be included into the wiring? This is really good stuff and needed for all those who would like to build this panel but don't know how to begin. I was wondering, Tigershark, where you would locate the resistors for each row of LEDs? I would think they should be between the Anode side of the row and the 7219 outputs. I'm looking forward to your next post. As Tigershark will probably agree, there are numerous ways you might approach wiring this panel. The rats nest of wires is the least preferred route. You want to keep it as clean and simple to help troubleshoot later on when something doesn't work. :( I have always tried to build my projects as a series of pieces or components or whatever you want to call them. My approach to this panel is to make 2 PCB's. One for the LED's and another PCB to house the MAX 7219 chip and arrange all of the LED traces for multiplexing with the 7219. That board will then connect to the Arduino board to run the whole mess.:thumbup: I have attached a PDF of my first draft of a PCB, actually two PCB's. The first one is the actual caution panel with all 48 LED's. If they don't look familiar its because I am using 5050 surface mounted LED's. Tigershark has proposed a 6x8 matrix. From my very limited knowledge of electronics that appears to be the perfect arrangement and that is what I am going to use. To that end, I have arranged my LED's into 8 groups of 6 and they all go to 14 pin connectors in the centre of each 2 groups of 6 LED's. I will then use ribbon cable to connect them to a second board that sorts everything into the appropriate pin assignments for the MAX7219 chip. From there you just need 4 leads to attach it to an Arduino board. Please refer to the PDF as you read this so you understand what it is I am trying to do. The board with the MAX7219 is a single sided board so I need to use some jumper wires. But you only need six. The jumper wires are represented by the extra thick lines that connect C2...C8 to traces that lead to "seg b" thru "g" and DP. Trying to engrave a double sided PCB is a process that requires exact registration and for having to use only 6 jumpers I opted for a single sided PCB. Its just so much easier. I haven't had a chance to test this yet but I don't believe it will blow up and destroy the world. However, this is still very much a works in progress and if you see anything that I screwed up in the layout, please let me know in this thread. And also note that I am just learning all of this too, so I could very well be totally out to lunch on how I am approaching this as well. I just wanted to use this layout as an example of yet another way of potentially wiring up the caution panel. I have had to edit the PDF that is attached with this post. It had some inefficiencies so it has been deleted and replaced with the a new PDF which has more information explaining what I have done. It follows Tigersharks excellent example but the layout is somewhat different as I have already explained above. Edited November 24, 2014 by Warhog The PCB Layout needs revising Regards John W aka WarHog. My Cockpit Build Pictures... My Arduino Sketches ... https://drive.google.com/drive/folders/1-Dc0Wd9C5l3uY-cPj1iQD3iAEHY6EuHg?usp=sharing WIN 10 Pro, i8-8700k @ 5.0ghz, ASUS Maximus x Code, 16GB Corsair Dominator Platinum Ram, AIO Water Cooler, M.2 512GB NVMe, 500gb SSD, EVGA GTX 1080 ti (11gb), Sony 65” 4K Display VPC MongoosT-50, TM Warthog Throttle, TRK IR 5.0, Slaw Viper Pedals
TigersharkBAS Posted August 8, 2014 Author Posted August 8, 2014 Hey Warhog. Thanks for the compliments about the explanation. The next part will indeed be about wiring up the Max7219. Regarding your resistor question. Resistors are not necessary as it is the RSET that determines the max amount of current that allowed to flow through to the LEDs. See the "selecting a value for RSET" section of this: http://playground.arduino.cc/Main/MAX72XXHardware [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
Hempstead Posted August 9, 2014 Posted August 9, 2014 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. Why not? AdaFruit's code too timing sensitive? Unable to handle large number of NeoPixels? Why is the Max7219 a better solution?
TigersharkBAS Posted August 9, 2014 Author Posted August 9, 2014 Oh no...it's certainly doable with Adfruit neopixels. I just meant not with the Arduino shield I was using. Advantages would be that you wouldn't need to use a chip and program everything using the Neopixel library for Arduino. Disadvantages would be cost (if you went for individual pixels that you would wire together) and working with SMD components (if you bought the neopixel LEDs in their most basic package for soldering to a PCB). The Max7219 works for me because I plan to use Through hole components and is used specifically for driving LED matrices. It has no distinct advantage over Neopixels...more of a stylistic approach I suppose. [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
Hempstead Posted August 9, 2014 Posted August 9, 2014 Oh no...it's certainly doable with Adfruit neopixels. I just meant not with the Arduino shield I was using. Eeeerrrr..... Why wouldn't the Arduino shield you use work? Advantages would be that you wouldn't need to use a chip and program everything using the Neopixel library for Arduino. I don't understand this sentence... what chip? One ATMega chip per string of NeoPixel? If you use the AdaFruit's extremely timing critical "demo" code for driving NeoPixel, indeed that would be the case. That code is so timing critical that even if you change the frequency of the CPU, it will break. And if you don't turn off the interrupts it will break too. It's only good for demo purpose, but people keeping using it. Check out this approach, http://www.pjrc.com/teensy/td_libs_OctoWS2811.html. And BTW, an NeoPixel costs USD $0.41, while an SMD LED could be had for USD $0.04, and a 5mm through hole LED is about USD $0.10 to $0.20. Even if you use 200 of them per pit, the price difference is minimal.
TigersharkBAS Posted August 11, 2014 Author Posted August 11, 2014 OK..let me start again....perhaps I am poorly explaining myself. My intention is to make a 1:1 scale caution panel. For this purpose, a 5cmx5cm neopixel shield is not going to help. If I wanted just a neopixel shield caution panel it would be fine. Using individual neopixels and chaining them together (each requires a single wire) is also a viable option. And requires nothing but connected Neopixels and few pin out put from the UNO. A was never questioning the viability of Neopixels....just saying that the shield was a great prototyping platform for me to test concepts before I moved on to a 1:1 scale perhaps built with more traditional components. For a regular non neopixel LED matrix on a UNO you would need to use some form of multiplexing that would require more pins than I am willing to sacrifice. I chose the MAX7219 to keep things simple in terms of the required outputs from the UNO. I am by no means advocating (or intend to defend) one approach over the other. I chose the MAX7219 to also learn about how it works for other projects as well. Having said that....the link you posted is very interesting. [sIGPIC][/sIGPIC] Creator of: F-18C VFA-195 "Dambusters" 1998 CAG Livery https://forums.eagle.ru/showthread.php?t=213788 F-18C VFA-195 "Dambusters" July 2001 CAG Livery https://forums.eagle.ru/showthread.php?t=215950 Pilot avatars for DCS Logbook https://forums.eagle.ru/showthread.php?t=221160 How to make a DCS A-10C Panel http://forums.eagle.ru/showthread.php?t=65998
albateo Posted November 24, 2014 Posted November 24, 2014 (edited) http://www.robot-italy.com/it/1032-phidgetled-64-advanced.html http://www.robot-domestici.it/joomla/component/virtuemart/Arduino/arduino-adk-rev3 can be good choice? Edited November 24, 2014 by albateo
Recommended Posts