Mandalorian Mercs Costume Club

Mandalorian Armor => Equipment & Accessories => Electronics => Topic started by: Coenn Jeenx on Jan 07, 2018, 08:50 AM

Title: Newbie - Arduino controlled kit
Post by: Coenn Jeenx on Jan 07, 2018, 08:50 AM
Greetings! I am still working on getting my kit approved - hopefully very soon - but in the meantime, I got some new toys over the Christmas holidays and am planning out my v2.0 Gauntlets and Bucket. I am a mechanical engineer by trade, so I have had some electrical engineering classes, done some soldering and basic circuits - but I am not an electrical engineer...I just know enough to be dangerous. But I am hoping to learn from you all and some hard work.

What I have done so far
What I have is an Arduino Mega, a starter kit with a bunch of stuff, a TFT touchscreen with micro SD card reader, and some ideas. I have already hooked it up and gone through some tutorials - made an LED light and blink, make a servo turn on and go 90 degrees CW and then back 90 degrees CCW, active and passive buzzers, etc. So I am on my way.

What I want to do
I want to put the screen on my gauntlet and have it scroll through wanted images at a minimum. It would be great if I could make it do a couple of different things, but timed change of pictures seems doable right now and would be cool. I also want to have some switches / toggles on my gauntlet to raise / lower my rangefinder as needed and maybe light up some sequenced LEDs either on my gauntlet or rangefinder. I also have a 7 digit readout that I may end up putting some sort of scrolling text or readout on my chest plate - but that is a like to have, not a must have at this point. I am trying to start small and grow in complexity as I learn and get better at programming, etc.

What I am looking for
I have been scrolling through the forums and see a lot of folks talking about doing this type of thing, but not many people posting the code or details to the schematics of how they set things up. I am watching the Mando Electronics guide post from AngelLM which is great and has provided some inspiration for what I want to do, but I am hoping folks out there would like to share any code they may have that works as well as schematics and component details of what they are using. I am going to be posting code I have worked up / adapted as well as pics of the setup and component details as my build evolves. If there are posts out there with code snippets available and / or schematics, perhaps people can reply to this with a link to those details so that this post can also begin to be a repository for new folks to get some good information all in one place.

As always, thoughts, suggestions, recommendations, warnings, etc are all greatly appreciated.
Title: Re: Newbie - Arduino controlled kit
Post by: Coenn Jeenx on Jan 07, 2018, 02:57 PM
I made some progress today. I was able to use one of the examples that came with my kit and put together a circuit that turns the servo 90 degrees one way when you press button a (and it lights a red LED) and then goes back 90 degrees when you press the other button. I don't have a schematic drawn up yet - I have not really worked on my schematic drawing skills yet, so that may take awhile to get to. But I do have some pictures.

The first picture shows the breadboard

Second picture shows the Mega board

My problems now are buttons or a different switch(s) of some sort. The ones that came with the kit work, but they are way to small to use in my kit.

The second problem, is power, but I think I have that solved - I am going to use a power bank I have that is 5V, though I have not tried it out yet.

The third problem is two fold - where to put the buttons and how to run the wires to the servo from the gauntlet. I discovered this morning that I will have to use two arduino's - the screen I have takes over all the PWM slots so I will eventually get a nano for the servo actuation. If I do that, I can put the nano in my non-screen gauntlet, but then I have to run the wires all the way to my bucket. I have started looking into wireless or bluetooth to make the servo wireless but I have not figured that out yet. I think I can place the nano with a transmitter in my gauntlet with a power supply and the receiver, servo and another power supply in my bucket and it will work. I am sure there is something I will have to change in the code to wirelessly control the servo, but I am hoping it is close enough that I can get there.

If anyone has a suggestion on what switches are out there that would work well in kit gloves, any links or vendor info would be appreciated.
Title: Re: Newbie - Arduino controlled kit
Post by: Coenn Jeenx on Jan 12, 2018, 12:29 PM
I have made some progress on my gauntlet. I was able to find someone on the forum that pointed me to some customer TFT screen code for the Arduino mega that made the screen AND the SD card work while plugged into the board. I did not have to custom wire things together or anything. I have also been able to convert a Mando true type font that I downloaded off the web to work not he screen. Right now it is very basic. I have about 10 images of various aliens / villains from Star Wars that I slowly display and then change, before I change the image, I flash up a bounty alert message in Mando. Excellent start I think - but I have more to do.

I want to work on the code so that in between each image, there is more text the comes up. If I can figure out how to make it scroll as if it is an incoming transmission or something more than just posting text - I will do that. I also want to try and figure out how I can make the images fit a little better and look more like "wanted" images. I am also trying to figure out how to add in flashing LED's that can also go onto my gauntlet as a "signal" there is an incoming transmission. If I can figure out how to do that, then the last bit would be to add in controls for my bucket fans and bucket servo for the range finder. Lots to do.

If anyone is interested, PM me and I can send you the Mandoa text file I am using for the display or direct you to the specific code I had to use for my screen to use with my mega board. The image below gives a little bit of an idea of what I have going on and what the font looks like on the screen.

Title: Re: Newbie - Arduino controlled kit
Post by: Hanjo Solba on Jan 12, 2018, 02:37 PM
This is very impressive.  I am so bad at circuit board work.  I ended up shoving a digital picture key chain into my gauntlet so i could put a readout in there.  No fancy scrolling, just looks like a status board of my com-link.  I will be curious how your going to fit this in the gauntlet.  (secretly commenting to watch build  8))
Title: Re: Newbie - Arduino controlled kit
Post by: rlobrecht on Jan 12, 2018, 02:56 PM
I eventually want to do something similar with my gauntlets.  Nice job.

I like the pinouts on the mega, but think it would be easier to fit one of the smaller boards in my gauntlets.

Watching with interest.

P.S.  Watch the double posting (replying when no one else has replied).  It is against the rules.  The preferred method is to edit your previous post and add the new content.
Title: Re: Newbie - Arduino controlled kit
Post by: Coenn Jeenx on Jan 13, 2018, 04:52 PM
Thanks for the comment. I am not much of a forum person except for on here - I did not realize I was “double posting”.

As far as size, the mega is big and my thought right now is to figure out the code and wiring then maybe switch over to a nano board or Uno - both are smaller. Right now, though - I think Even this would be alright if the gauntlet were built around it. While I keep working on my build, my next step is to start working on figuring out how to incorporate whatever arduino board into a gauntlet. If anyone has pictures of doing something similar - please point me to your post or share here. Otherwise, a hunting we will go on the forums...

So I have a few things to update.

TFT Screen Gauntlet
First I was able to get my screen working well with Mandoa font I uploaded to the screen, it is rough - but it works. My next steps are to add an "on/off" power switch and start to figure out how to build the gauntlet around the screen, etc. Not sure what I am going to do about that...

Helmet fan
I have a fan with a battery pack and an on / off switch all together and working well. I just have to figure out where I can fit it into my bucket and mount it in there.

Arduino Nano Rangefinder stalk servo control
I decided to split the servo from he TFT screen to reduce the drain on the battery of that system. I have it all mocked up with a breadboard and two momentary switches but I want to change it over to use a single on-off-on toggle where one direction rotates the rangefinder up, off is just that - off, and the other direction drives the rangefinder back to the zero position. It works, but when I swap out the momentary switches for the toggle, when I flip the switch and leave it in the on position - the servo stutters horribly. If I switch it on and off quickly - it moves where it is supposed to. I have posted my issue to an Arduino forum for help, but if anyone here has an idea - I would appreciate an outsiders perspective. I think my problem is with the code - either how I have the loop setup or how I have the switch signals setup. Right now there are HIGH or LOW but it is acting like it is continuing to try and check the status constantly and because of that it just keeps stuttering till I switch it off. The first picture below is with the two momentary buttons while the second image is the setup with the toggle switch.



Here is my code right now. You can see I had some other things in there - LED's, but I have commented those out since I moved over to the nano board until I figure out how to do the servo rangefinder - then maybe I will add some lights....
Code: [Select]

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards
// Use two buttons to control servo position.
// First button moves from 0 to 90 degrees
// Second button moves from 90 to 0 degrees

int pos = 16;    // variable to store the servo position

//int ledPinR = 3;
//int ledPinG = 4;
int buttonApin = 9;
int buttonBpin = 10;

byte leds = 0;

void setup()
  //pinMode(ledPinR, OUTPUT);
  //pinMode(ledPinG, OUTPUT);
  pinMode(buttonApin, INPUT_PULLUP); 
  pinMode(buttonBpin, INPUT_PULLUP); 
  myservo.attach(10);  // attaches the servo on pin 9 to the servo object

void loop()
  if (digitalRead(buttonApin) == HIGH)
    //digitalWrite(ledPinR, HIGH);
    //digitalWrite(ledPinG, LOW);
  for (pos = 90; pos <= 180; pos += 1) { // goes from 00 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    //delay(1000);                       // waits 15ms for the servo to reach the position
  if (digitalRead(buttonBpin) == HIGH)
    //digitalWrite(ledPinR, LOW);
    //digitalWrite(ledPinG, HIGH);
    for (pos = 180; pos >= 90; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    //delay(1500);                       // waits 15ms for the servo to reach the position


I got my servo switch working nearly 100%. I cleaned up some wiring and started working towards how I will work it into my bucket and that is where i hit a snag. I have been looking on the forums for a rangefinder that I could use to run the wires up the stalk and install some lights in the top - but I cannot seem to find any. I also tried searching for any how-to's as to how make my own and recommended materials. If anyone has any recommendations or links they can share to how I can go about making such a rangefinder, I would appreciate it. I am also hoping maybe someone has an idea as to what is causing some random strange behavior in my setup.

My setup is a nano with an on-off-on type switch. When I first turn on my nano, it sets the servo to a certain position - up. When I flip the switch it turns 90 degrees (down) and turns on some lights. When I turn the switch to off, the lights stop. When I flip the switch to the other on position, it rotates back to the starting up position. The problem I am having is the seemingly at random times, the servo will turn 90 degrees without me flipping the switch. I am thinking this may mean I need to add a capacitor or resistor somewhere in my circuit - but my knowledge of electronic circuits is at it's current maximum.

Any feedback or help would be greatly appreciated.
Title: Re: Newbie - Arduino controlled kit
Post by: jc27 on Mar 09, 2018, 10:46 AM
If its being triggered without you hitting a switch, it more than likely is getting an intermittent signal on the input pins. It could e a debounce type scenario, or maybe set the input pins to a value of low, then have the signal that triggers the servo that goes to those input pins to a high.
Title: Re: Newbie - Arduino controlled kit
Post by: LightningLion on Mar 11, 2018, 11:54 AM
Read here ( about Input pullups. It will (partially) solve your problem.