查看: 6825|回复: 8

[配件] 旋转立体LED灯 附原理图 程序

  [复制链接]
  • TA的每日心情
    开心
    2014-11-18 14:49
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]初来乍到

    发表于 2012-9-4 21:25:33 | 显示全部楼层 |阅读模式
    分享到:
    本帖最后由 ghostpirate 于 2012-9-4 21:27 编辑

          不是用launchpad做的 ……   不过蛮有意思的 ……  先说说原理吧 汉文的没找到原理讲的详细的 找到了英文的……  中文的原理图和程序在最后
    原地址  http://www.rickard.gunee.com/projects/mechscan/dualpic/gamesys.php  感谢原作者   应该能看懂吧

    Virtual Game System - A game console with a mechanically scanned display.
    Introduction
    If you move a bright light fast by the eyes, it will leave a line behind because the human brain and eyes are slow to interpret fast changes in light intensity, leaving an afterglow. If a row of LED’s is moved sideways while the LED’s intensity is changed, an image will shortly visualize in the air where the LED’s are moved. If this is done several times, for example if the LED’s are mounted on the end of a bar mounted on a motor as in the figure on the right, the same area in the air could be scanned several times showing the same image each time. Done at high speed it would generate a quite good virtual display hanging in air thanks to the persistance of vision effect of the brain. People has started to refer to this kind of display as POV-displays (Persistance of vision displays) as if it was the only type of displays depending on the peristance of vision effect but that is kind of ignorant as many display types use the same effect, like for example CRTs and multiplexed LED displays, thus "mechanically scanned display" is a more accurate name.
    The idea of making a mechanically scanned display came from Bob Blick’s mechanically scanned clock. He made a clock using the same technique, so I wanted to take his idea a step further and make games with it, resulting in this project. The biggest problem to do this was the communication between the game system and the graphics card. This was not a problem for the original mechanically scanned lock because in that system the clock-functionality was built in to the graphics card. So no communication was needed for the clock.

    The mechanics
    The mechanics is an essential part of this project since it is a mechanically scanned display. The system has basically two parts, one solid platform, and one rotating rotor. The rotor is a bar, with the graphics card in one end, and a balance weight in the other. On the graphics card, a Plexiglas bar is attached, with 16 LED’s (10mm) attached on it. To get a wider viewing angle of the LED’s they have been made rugged with sandpaper.
    To get a more stable rotor, the motor is attached and rotating with the rotor, and the axle is mounted at the platform. The motor has an extra long axle, so the three ball bearings, for power supply and communications can fit between the rotor and the platform.

    Picture of the rotor and platform (Click to enlarge)Drawing showing the motor attachment


    Communications
    One of the hardest problems in this project has been the communication between the rotor and the platform. The mechanically scanned clocks that have been done before didn’t communicate with anything, the clock functionality is in the microprocessor that is rotating with the rotor. The power supply have been transmitted to the rotor in many different ways, for example by taking it from the rotor of the motor that is getting it through coal contacts, or some people have used bearings, but my choice was to use ball bearings with wires soldered to them. First when only the power supply was to be transmitted through them, it seemed ok, but as I first tried to communicate between the two PICs the result was catastrophically bad. As the bearing was not conducting all the time due to micro gaps, it was impossible to do any communication at all, when looking at the signal it was full of noise, but the power supply didn’t have this problem. So I tried to increase the current to 100mA when communicating, and it really decreased the noise by breaking through some of the micro gaps. Now it was possible to see the information clearly, but the amplitude was lower and it had a quite big offset from the ground level of the game system. This was due to there is some resistance in the bearings, and when running a big current through them, there was a quite noticeable voltage drop. The voltage difference problems was solved by removing the DC component of the signal with a capacitor and add a bias voltage (VDD/2=2.5V). Now it was possible to get a clear signal by using an operation amplifier to compare the signal with an adjustable reference level. The communication problems were solved! The same circuit for communication is used for both the graphics card and the game controller.

    Detail picture of the communication bearings and the IR synchrnization LED and switch (Click to enlarge)Detail drawing of the communication bearings


    The graphics card
    Picture of the graphics cart and LED's
    (Click to enlarge)

    The graphics card controls the LED’s, these are driven by two 74573 latches. These are connected to Port B, and the latches are selected with the two lower bits of Port A. To limit the current through the LED’s there is one 270 current limiting resistor on each LED. The synchronizing IR.-switch is inputted at pin 2 of the Port A, giving a positive pulse as the IR.-switch passes the IR.-led. The IR led is placed inside of a tube, to make the IR beam more narrow, giving a more stable picture.
    The communication interface is connected to pin 2 and pin 3 of Port A. Using a standard voltage regulator (7805) the 5v-supply voltage is achieved. Because of the noisy environment, both sides of the regulator got big capacitors to reduce noise.

    Schematic over the graphics card. (Click to enlarge)


    The game control unit
    Picture of the game system control unit
    (Click to enlarge)

    The game control unit is based on a PIC16F84. It has two 74245 to read the joysticks, and one DA converter (TLC7524) for sound. To select one of these three devises are selected by a 74139 demultiplexer, controlled by the two lowest bits in Port A The data bits of the DA and the 74245’s are connected to the Port B of the PIC, but only using the 7 lowest bits. This is because the seventh bit is used as SDA, and together with the fourth bit of the Port A as SCL, forming an I2C interface. On the I2C interface, a real time clock and an eeprom (2kB) is connected. The clock is for keeping track of the time (For the implementation of the clock), and the eeprom is for storing game data, not used in my test software though.
    To get correct voltage out from the DA, a reference voltage is needed, this is generated by one transistor (BC547), one resistor and one potentiometer to be able to adjust voltage. The communication interface is connected to pin 2 and pin 3 of Port A.
    The joysticks are digital joysticks, the same kind used with the old game computers Amiga and C64, connected with 9p-dsub connector.
    A standard 7805 regulator is used to get the 5v-supply voltage needed for the circuit.
    Unfortunately I originally misplaced the layouts, but I found the layout for the gamesystem (but not the graphics card) recently on paper and have scanned it. Here is a reverseengineered component placement, I'm not 100% sure if it is correct but it is something.

    Schematic over the game system control unit. (Click to enlarge)


    The graphics card software

    Startup test image, showing
    that the display is up and running

    The graphics card is a high performance application, so the code was written in pure assembler. It has two main tasks, showing the image, and interpreting and performing graphic commands.
    At startup the image shown is a test image to see that the graphics card is working correctly, as seen at the right picture.
    The main loop is reading the communication port continuously and performs the command sent. If the game system doesn’t send any command the game system reads 0xFF and that is interpreted as a "no operation" command. When a command is received, the lower 3 bits (bit 0-2) are the command, and bit 3 tells what color the command should be in, where a zero means "off" and a one means "on". The commands that can be sent are:
    0 - Clear screen ()
    1 - Put Pixel (x, y)
    2 - Horizontal Line (x, y, length)
    3 - Vertical Line (x, y, length)
    4 - Put a character on the screen (x, y, char)
    5 - Load entire graphics memory (mem0…mem47)
    6 - Draw line using Bresenham's algorithm (x1, y1, x2, y2)
    7 - No Operation ()
    Some of the commands have parameters, these are the ones shown in parenthesis after the commands. They are sent directly after the command byte, all parameters are one byte each. Most of the memory used for the graphics controller software is the bitmaps for command 4 – putchar. It can output letters A..Z, numbers 0..9, and a few special chars for example parentheses, apostrophes etc.
    The communication protocol is quite simple. For each byte, one start bit (zero) is sent to the game controller, then a synchronization bit follows, telling the game controller if the screen is being drawn (like the vertical sync indication bit in a standard graphics system). If the sync bit is not zero, then the game system can start a transfer to the graphics controller. First a start bit (zero) is sent from the game system to tell the graphics controller that a byte is coming. Then the byte follows with the LSB first and the MSB last. Each bit transferred takes 20us.
    Each time the read byte operation is performed, a check of the IR-switch is done. If the IR-switch output is high, then the screen is to be draw before the command can be performed. The screen memory is organized in columns instead of rows (that standard graphics controllers are using), this because a whole column is shown at the same time. Showing one column is quite easy. But to make the layout of the PCB easy, the bits are not in order, and therefor reordered before outputted to the LED’s. The piece of code showing the display gets one column of graphics data from memory, reorders the data output the data to the LED’s waits for a while, then do it again. This is done for all 24 columns, each 16pixels high.
    To get be able to see the pixels in x-axis better, there is a little gap between the pixels where they are turned off. The time the LED’s should be on and off is dependent of how long time a lap takes. So to get a constant image size, an interrupt routine is counting how long time a lap takes, and from the lap-time the delays are calculated.

    The game control system software.

    The software in the game system has quite low performance requirements, but the code is quite complex, so it was ideal to make it with a c-compiler. (PIC-C by Hi-tech Software from Australia, their compiler is the best C-compiler available for the PIC) The communication routines require very precise timing, and therefor they are written in assembler. The images below shows what programs I've implemented on the system.

    The game Pong implemented on the virtual game system.The game Tetris implemented on the virtual game system.
    A clock implemented on the virtual game system.A text scroller that shows text sent from a RS232 port.


    Download.Schematics, source-code and hex-files are available in vgsys.zip(34k).

    More mechanically scanned stuffIf you want to know more about mechanically scanned stuff, check out some of these links:
    Bob blick's propeller clock
    Daryl Bender's propeller clock

    旋转LED资料.part1.rar

    7 MB, 下载次数: 190

    旋转LED资料.part2.rar

    3.13 MB, 下载次数: 184

    回复

    使用道具 举报

  • TA的每日心情
    开心
    2014-11-18 14:49
  • 签到天数: 2 天

    连续签到: 1 天

    [LV.1]初来乍到

    发表于 2012-9-4 21:30:00 | 显示全部楼层
    附件是另一个方案 网上最常见的那种   竖直水平都有显示
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2015-11-4 19:13
  • 签到天数: 281 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2012-9-4 21:33:32 | 显示全部楼层
    有点意思,利用视觉暂留,感觉点LED的算法不简单。

    PS:论坛现在做活动的PSoC3也有一个利用视觉暂留的功能,这种东西总是让人感到新奇
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2015-11-4 08:32
  • 签到天数: 773 天

    连续签到: 1 天

    [LV.10]以坛为家III

    发表于 2012-9-4 21:38:30 | 显示全部楼层
    能做出来,就是高手啦.
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    2016-8-25 12:42
  • 签到天数: 692 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2012-9-5 10:18:34 | 显示全部楼层
    很有创意啊,好帖子,顶一个!
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    难过
    2015-7-11 15:23
  • 签到天数: 567 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2012-9-9 20:00:50 | 显示全部楼层
    外语水平不高,六级木有过啊
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    发表于 2012-9-10 10:13:28 | 显示全部楼层
    醉清风 发表于 2012-9-9 20:00
    外语水平不高,六级木有过啊

    六级过了的看着也费劲,哈哈
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    难过
    2015-7-11 15:23
  • 签到天数: 567 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2012-9-10 14:00:19 | 显示全部楼层
    tina 发表于 2012-9-10 10:13
    六级过了的看着也费劲,哈哈

    确实,不过学这个专业的,免不了英文,还得努力啊
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    无聊
    2017-9-11 09:31
  • 签到天数: 155 天

    连续签到: 1 天

    [LV.7]常住居民III

    发表于 2012-9-11 13:36:16 | 显示全部楼层
    那位大侠把它翻译成中文 造福大众吧
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    手机版|小黑屋|与非网

    GMT+8, 2024-4-24 19:45 , Processed in 0.195656 second(s), 32 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.