Author Topic: Arduino  (Read 178 times)

0 Members and 1 Guest are viewing this topic.

Offline MartyS (Gromit)

  • Compsognathus
  • *****
  • Posts: 10444
  • Liked: 2178
  • Weirdies!
    • My homepage
Arduino
« on: December 23, 2017, 08:37:41 PM »
Anyone here play around with Arduino boards?

I picked up a big starter kit and some extras, starting to learn how to program it.

The microcontroller in the control system for the observatory at work died, and the company that made the system switched to different hardware 7 years ago and can't replace it.  To get the dome controlled by a computer again all the companies I've contacted want to replace everything, 8 to 10 thousand bucks just because of a dead $50 board...

I know an Arduino mega has enough inputs and outputs to signal the motor controllers and radios to move and open the dome, so I'm going to see if I can get one to work.

3D printed a nice part to hold a breadboard and the Arduino, just made this to control some relays with push buttons, it's a start, eventually the push buttons will need to be replaced with serial commands from the computer.



Offline Variety of Cells

  • Climbed El Capitan
  • *******
  • Posts: 5446
  • Liked: 1125
Re: Arduino
« Reply #1 on: December 23, 2017, 09:08:45 PM »
Hey that looks really cool. Keeps us posted on whether it works or not.


Offline MartyS (Gromit)

  • Compsognathus
  • *****
  • Posts: 10444
  • Liked: 2178
  • Weirdies!
    • My homepage
Re: Arduino
« Reply #2 on: January 12, 2018, 12:00:39 PM »
Well, I've made some progress, learned how to put info on an LCD display, got it wired up so it reads all the switches that tell if the dome shutters are opened or closed, and using some transistors I can use the arduino to command the motors to open and close the shutters and rotate the dome.

But the rotation encoder puts out pulses too fast for the arduino to read, so no way to read where the dome is without either finding a different encoder or using something other than an arduino....

There doesn't seem to be any middle of the road when it comes to rotation encoders, they are either cheap ones for use for radio knobs, or expensive industrial ones.  Might have to come up with my own way to track the dome, the encoder on there now has many orders of magnitude too much resolution, 21 foot diameter dome and it's putting out 500 pulses when it rotates about 1 inch.  One or 2 pulses per inch would be fine, the shutter is 4 feet wide...


Offline MartyS (Gromit)

  • Compsognathus
  • *****
  • Posts: 10444
  • Liked: 2178
  • Weirdies!
    • My homepage
Re: Arduino
« Reply #3 on: January 16, 2018, 06:58:16 PM »
I built a plexiglass box for the Arduino, the display, and the little board with the output transisters, it should fit in where the old microcontroller fit.



I'll cover the USB port on the side with electrical tape, that should make the box fairly weather resistant.  The USB port is only used to program the Arduino, there is an RS232 line to the observatory computer that will be used to send commands, after I figure out how to get the Arduino to accept commands over the serial port, at least there are some tutorials out there on how to do that so I'm not starting from scratch.  Still lots of programing to do...

And I have to buy or build a rotation encoder that puts out fewer pulses per revolution.  But if I can get the dome shutters opening and closing from inside right away that will be a help, it takes a few minutes so to open up and hour early to even out the inside/outside temperature you have to stand there holding the buttons the entire time, that means getting dressed for cold weather just to go open the dome.


Offline MartyS (Gromit)

  • Compsognathus
  • *****
  • Posts: 10444
  • Liked: 2178
  • Weirdies!
    • My homepage
Re: Arduino
« Reply #4 on: January 19, 2018, 12:02:12 PM »
It's working for shutter control, I ordered a $40 rotation encoder that is fewer pulses per rotation, hope it works once I build an adapter to connect it to one of the dome motors.

Up to over 500 lines of code, even got it automatically closing the shutters if the rain sensor senses rain.  Man I still hate programing, and testing, and more programing and more testing.................



Offline MartyS (Gromit)

  • Compsognathus
  • *****
  • Posts: 10444
  • Liked: 2178
  • Weirdies!
    • My homepage
Re: Arduino
« Reply #5 on: January 19, 2018, 06:40:03 PM »
Rotation encoder came in and with all the code I have running on the board the pulses are still too fast unless I turn the encoder pretty slowly.   So it looks like I'll be attempting to build my own.  Not that hard really, just a disk with slots in it and 2 LEDs and 2 photo-diodes to sense when the slots move past.  You tell direction by which photo-diode turns on or off first.  But it will take a while to machine the parts...

Or build a gearbox, I figure slowing down the rotation of the motor shaft about 5 to 1 would make the new encoder work...


Offline Lunquewill

  • Sparkles in Sunlight
  • *
  • Posts: 76
  • Liked: 1
Re: Arduino
« Reply #6 on: January 20, 2018, 03:25:26 PM »
Interesting! Did you write all of the code, or did you find some useful bits from other places?


Offline MartyS (Gromit)

  • Compsognathus
  • *****
  • Posts: 10444
  • Liked: 2178
  • Weirdies!
    • My homepage
Re: Arduino
« Reply #7 on: January 20, 2018, 06:22:14 PM »
It's a fariy unique system, so couldn't really use much from the tutorials.

Not that it's all that complicated, reading switches to tell when doors are open or closed, sending signals to the relays that control the motors to do stuff.  But debugging is a pain, have to take the box up to the dome and install it, try out various commands, see what works correctly and what doesn't, then take the box back to my office to figure out how to change the code.  I am also using a second Arduino hooked up to a breadboard with LEDs to simulate the motors and wires plugged into ground to simulate the switches, but even with that I've missed a few things like the system not working if the doors are stopped half way so neither end switch is tripped.