Jump to content

Kotagi

Members
  • Posts

    212
  • Joined

  • Last visited

Everything posted by Kotagi

  1. What size cap would you use to equalize voltage and make it less jumpy? Also I got it all working. I wish I had a camera to show you. It responds very well to the fuel consumption in game. Then when I stage, It shoots back up to full for every stage. Would you guys be interested if I posted the code as I go so you can see how it evolves? Im not a pro so I only assume my code will be far from perfect..But if you guys want me to do that I will. Let me know. #!/usr/bin/env python import RPi.GPIO as GPIO import time import krpc LedPin = 16 conn = krpc.connect(address='u.dont.need.to.know' , name='meter') # Connects So Kerbal Server vessel = conn.space_center.active_vessel # Creates Object Representing Vessel totalLF = conn.add_stream(vessel.resources.amount , 'LiquidFuel') maxLF = conn.add_stream(vessel.resources.max , 'LiquidFuel') tankPer = 0 def setup(): global p GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output GPIO.output(LedPin, GPIO.LOW) # Set LedPin to low(0V) p = GPIO.PWM(LedPin, 1000) # set Frequece to 1KHz p.start(0) # Duty Cycle = 0 def add(): global totalLF global maxLF global tankPer tankCap = (totalLF() / maxLF()) # Converts Capacity Into Decimal tankPer = int(tankCap * 100) # Turns Decimal Into Percentage #print('Current: ' , totalLF()) #print('Total: ' , maxLF()) print ('Tank: %{}'.format(tankPer)) def loop(): while True: global tankPer add() for dc in range(0, tankPer , 1): # Increase duty cycle: 0~100 p.ChangeDutyCycle(dc) # Change duty cycle def destroy(): p.stop() GPIO.output(LedPin, GPIO.HIGH) # turn off all leds GPIO.cleanup() if __name__ == '__main__': # Program start from here setup() try: loop() except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be executed. destroy() This is what I used to get the meter to display the fuel readout.
  2. Ok so I got the meter running with the fuel on the game. I need to add a cap to stabilize the voltage. Its a little shaky on max but working good enough for right now.. I do have a question though. So I was hoping fuel would be displayed as a percentage of capacity but I havent been able to find that yet. It displays in units. My problem is that I am using the duty cycle of the pwm as the variable I set to the fuel units. The variable has to be between 0-100. Fuel can be 1000's of units or just a couple so I need a piece of code that will scale any number to a 1-100 scale setting the initial input number as 100%. Probably do this by making it a decimal. Any thoughts? Anyone else on here use Krpc?
  3. Man I wish my phone wasnt broken..So I got my launch button working and its so sweet. I really thought this part would take alot longer. Im sure my code isnt the cleanest it can be since I basically Frankensteined it together, but when I press my emergency stop button in says launch on the pi console and it turns on autopilot, sets a heading, throttles up, and stages. All from 1 button press. This seriously has endless potential. The pi can be extended to have over 900 pwm outputs with breakout boards from what I read. That means I can literally make every switch in the op. It will def take awhile but I now know it can be done. I still need to build a center console for the main buttons. And I still need 5 screens before I go any further on cosmetic work. But its definitely making progress
  4. I guess since you asked twice @HoloYolo Back to you my friend, no tag backs..lol
  5. I can definitely try to do a better job than I have been. My phone broke so I wont be able to take pics for a couple weeks while it gets fixed. I bought the sunfounder kit that had all the basic components plus the code that went with it. Ive been using the gpio extension board, and a breadboard to play around with different circuits without having to do any permanent wiring. As for krpc, follow the instruction on the getting started page(make sure to copy all the files from the krpc zip). Once the server is started, on whatever machine you want to connect, you need to download the libraries for krpc(Also on the getting started page. Windows and Linux have different methods). You need to know the ip address of the host computer(running ksp). Then you can use IDLE for Python 2.7 to connect to the server. import krpc conn = krpc.connect(address='host.ip.address' , name='Connection_Name') vessel = conn.space_center.active_vessel print(vessel.name) If you get the name of your vessel back than you did everything right. That is where I am right now. I will update more as I figure everything out
  6. So my brain hurts..lol. Im going to take a break for the day. I fully controlled my craft from the pi by running a script. Tomorrow I will try to connect some switches and the meter and see what I can get working. We will see. Mission accomplished today though Btw, I wasted the whole day because I only copied the gamedata folder from the krpc zip. Once i copied all the files everything worked like a charm. And it was almost instant response. My pi is only connected over wifi so I thought I would get some delay but I guess not. Maybe as the pragram gets more advanced I will run into that.
  7. Alright got it working on the local machine The Pi is now connected . I just had to complain a little
  8. I cant get krpc to work at all. I spent all day. The server turns on..Just cant connect to it. From the pi or local machine. This is aggravating..Its probably user error but the instructions seem pretty simple
  9. It has 1 hardware pwm and the rest can be used as software pwm. As far as I know, you have to buy a breakout board for DAC though(from the 5 minutes of research I just did) There is also breakout boards to add hardware pwm outputs if I needed them
  10. I had a 100k sitting in front of me so I used that. Its awesome how easy it is to control the range though. This is so rewarding when you get something working like this. And once I get 1 working in game, it will be just repeating the process over and over I assume. This is exciting
  11. https://vid.me/zdwC So the meter works perfect. Thanks for the help. Now I need to dive into krpc and figure out how that works. But this was a big step. Thanks again
  12. Is it even possible to do this with a raspberry pi? Its looking like arduino would have been the way to go...Could the pi access the variables on my windows pc from kerbal? Maybe I just havent read enough yet but if anyone could point me in the right direction that would be great
  13. Thank you for the info. It all makes alot more sense now. I will let you know if I run into any problems getting it to work. BTW I saw your updated meters with the lights installed. It looks awesome. Keep up the good work
  14. Or this? https://www.amazon.com/gp/product/B01FBGOSEQ/ref=ox_sc_mini_detail?ie=UTF8&psc=1&smid=A2TOL213PF2CAG Ok I will have to completely disassemble the meter and find out. Thanks for the input
  15. Of course I got the 1 thats harder to work with...lol. So is this something that will work? http://www.ebay.com/itm/Voltage-to-Current-Signal-Transmitter-0-3-3-5-10-15V-to-4-20mA-Linear-conversion-/182050042476?hash=item2a6307326c:g:vuoAAOSwu1VW4YYe I see it has a 20ua max so its about half of what is needed correct?
  16. It says international instruments and it has a couple different numbers on it 91145174 FS50DCUA 8949 patent no. 2871450 I have family coming in from out of town so I probably wont get to play around with it for a few days. I def dont have a bench meter but it looks like one would be very useful. They are pretty pricey though. It registered about a third of the scale with a aa so maybe its a 5v that would be awesome but I couldnt know that for sure until I play around a little more..To bad it was the last 1 on amazon
  17. And so it begins....lol Got it for 10- off amazon but it didnt have a description so I dont know if its volts or amps and dont know what the scale is. Could be totally useless wont know until I hook it up
  18. I was so tired i must have missed this last night..That's pretty good
  19. http://vid.me/OxPh Last one
  20. Lmao. Where there is a will there is a way..
  21. Yes it is. Im experimenting with different resolutions and this looks really good so far. This is just a sneak peak..lol Thank you. I am just as antsy to see it all done as well but I want to spend time on the details. Try to at least. Im focusing on the basic elements to get it up and running and Im going to build from there.. Thanks man I think it looks pretty awesome as well. The stretching is a problem right now because i havent added the back 2 screens yet. 5 flight screens in total. Basically at the edge of the screen is about 180 degrees, so I need to have 180 degree window to account for that. I think when I add the back 2 it will fix it though. Im going to work on the big screen first. I have a gtx 970 and gtx 950 for a total of 8 screens plus I can add an endless amount of telemetry screens with raspberry pi's. BTW that pic of the moon is pretty epic. I thought about adding a fog machine in the dash or vent system for when it overheats too. Someone on reddit gave me the idea..The more special effects the better
×
×
  • Create New...