General Discussion

official

#13

@Alexg42 is any of the copper part left? If so, that happened to me and I was able to re-solder to make a connection. After that I used hot glue so it didn’t wiggle around afterward.

If the whole copper part fell off, then I’m not sure, sorry :frowning:


#14

Looks like 1 has no copper left, 1doesnt. Damn!

Just tried making a new connection and there’s no way to, there’s not enough copper I can attach to


#15

Probably need a new motor, but you could just buy a motor, if you could identify it. It pulls out of the gearbox. They are just a couple of bucks on Ebay or Amazon. Thimble might give you one also.


#16

Cheers! Got a new one on its way, found what looks like the exact same one that comes packaged too


#17

You need 2 people. Use some needle nose pliers to pull (i.e. tug on the black connector) as you de-solder as shown in the video above.

1 guy tugs and jiggles with pliers as you de-solder and move down the line.


#18

Just pinch the wood with your fingers tightly as you slide - it’s slightly better solution than cutting the already flimsy wood piece.


#19

they didn’t do a good job showing how to prevent ripping off the copper flap of the motor. I’ve ripped mine off in other projects, so…

What you want to do is run the wires through the transparent lip right next to the copper, that will prevent you from accidentally ripping it off. They didn’t do that in the video though.

Also, you can hot glue the wire to the motor

Thorboy


#20

Hey everyone,

This is my first post and I’m just trying to get caught up. I’ve successfully completed the first part of the wifi robot and there is something that I was curious about with regards to the arduino sketch that we created:

// Function to write out pwm values
void writePwms ( int left, int right) {
analogWrite (pwms[0], left);
analogWrite (pwms[1], right);

I get the basic idea of this section of code, but there is something that I’m struggling with. I’ve never done any hardware programming before, so that’s probably why this isn’t obvious to me. But in this function (not sure if they are called functions in arduion sketch) this function is called by all of the motor functions (forward, right, left, etc) and transfers integer values into the function parameters (left and right). But the part I’m unfamiliar with, is where the funciton then uses those values to ‘analogWrite’ to pins 0 and 1. Is this because values need to be stored in the pins? Should I think of this as being stored into memory? Sorry if this question seems dense…something isnt’ clicking in my brain.

Cheers,
Taolin


#21

I don’t think PWM was really covered in the modules. Basically it’s how to simulate an analog signal from digital:

https://www.arduino.cc/en/Tutorial/PWM

Near the top of the sketch, pwms is declared:

// Array to track current PWM values for each channel (A and B)
int pwms[] = {APWM, BPWM};

And above that the APWM/BPWM pins are set:

#define APWM 5
#define BPWM 11

Those are part of the 7 pins the motor controller uses. Part 2 covers this some in the schematic:

So looking at goForward() for example:

// Move the robot forward
void goForward ( ) {
  digitalWrite(STBY, HIGH);
  digitalWrite(AIN1, LOW);
  digitalWrite(AIN2, HIGH);
  digitalWrite(BIN1, LOW);
  digitalWrite(BIN2, HIGH);
  writePwms (STRAIGHTSPEED - leftOffset, STRAIGHTSPEED - rightOffset);
}

We’re toggling (i.e. digital) STBY, AIN1, AIN2, BIN1, and BIN2 pins, and analog controlling the speed with APWM and BPWM pins. Because in Part 1 we’re just moving the robot forward/backward/etc. by STRAIGHTSPEED and TURNSPEED, it seems unsatisfying. Later in Part 2 when you hook up the Blynk.cc app to use a joystick, the analog sliders for finer speed control will make more sense with the PWM functionality.


#22

Hey there! Thanks for the quick reply :slight_smile:

I fully understand all of that…the part I don’t get is:

analogWrite (pwms[0], left);
analogWrite (pwms[1], right);

Looking up the analogWrite function on the Arduino site, it would seem that it is passing…oh wait…

CLICK

It’s because of this:
int pwms[] = {APWM, BPWM};
This is declaring an integer array. In the array is APWM and BPWM, but they were declared earlier so calling them by name is the same as passing the pin numbers into this array?

So, when you have this:
void writePwms (int left, int right {
analogWrite (pwms[0], left);
analogWrite (pwms[1], right);

While considering the following syntax:
analogWrite(pin, value)

it would go a little like this for the goForward function (assuming there was no offset values set)

\the value 200 gets passed into the to parameters and is assigned to both left and right variables
void writePwms (200 left, 200 right {
\these two lines send an analog value to the APWM and BPWM pins (which was declared as pin 5 and pin 11) and that value is set as left which equals 200
analogWrite (pwms[APWM=5], left=200);
analogWrite (pwms[BPWM=11], right=200);

Sorry for my messy syntax. I’m trying my best to articulate what’s in my brain…I have no programming experience.

Does what I’m saying make sense? Am I on the correct track?

Cheers,
Taolin


#23

Yep! In Part 1 with fixed speeds (and assuming no offsets for mismatched motors), goForward() would be calling writePwms(200,200) which would call analogWrite(5,200) and analog(11,200). Because of the #define at the top, you can use the name APWM instead of the value 5 anywhere in your code. The compiler swaps them out for you. It typically makes for nicer to read code, instead of having hard-coded magic numbers all over the place.

I think something that’s a little off is viewing it as pins 0 and 1. Those are just the array references. When pwms is declared, it’s an array of length two (just indices 0 and 1). So pwms[0] is APWM and pwms[1] is BPWM. Array locations start numbering at 0, just like the pins.

But overall yeah, it seems like you’re on the right track here!


#24

Yes exactly! That was the part that clicked for me. I didn’t initially understand that the calls for [0] and [1] were actual addresses in an array as opposed to actual pins. It all makes perfect sense to me now. I appreciate the help!

Cheers,
Taolin


#25

Definitely think that for future projects the coding part should be explained much better, I have been struggling too.

For a complete beginner like me it’s pretty tough I thought


#26

I agree that it was definitely tough. I’m also a beginner at coding, but I’d encourage you to go back through some of the basic codes (the one making it go back and forth) and just figure it out by looking for patterns, repeated commands… I’ve already learned a lot just by doing that. Also, I’d recommend two other things:

  1. Look for basic Arduino tutorials, either books or videos. There are a lot of people on YouTube that have playlists from basic codes all the way to small projects

  2. Try using drag-and-drop programs like Scratch to learn the fundamentals of coding. Like I said, I still consider myself a beginner, but from my understanding, drag-and-drops programs are pretty much the same as coding, just without the actual code, or in other words, in English rather than a confusing programming language


#27

Thanks for letting us know, Alex! We’re working on creating better instructions/tutorials so that the coding portion isn’t as tough. Anything in particular that you’d like to see in the coding explanations? Perhaps covering more content? Thanks for the feedback in advance! Oscar


#28

Hi Alex,
yeah we have jumped in fairly deep straight off with building this bot first up.

Perhaps you should try looking at the examples in the Arduino IDE. They guide you thru this all at https://www.arduino.cc/en/Tutorial/HomePage
If you can buy the basic electronic parts that are needed for some of them, that would help. Things like LED’s a 10k ohm Potentiometer, they should only cost a couple of dollars.
This will give you a good introduction to the Arduino the IDE platform and programing as well as putting together the basic electronic components.

Good luck
Coyote


#29

Thanks I’m glad, to be honest if you started from basics to help users fully understand the syntax while writing it and how each line effects the board and what exactly each statement is doing, that would be useful

Even examples of smaller programs to help, it’s quite overwhelming to have a wall of code straight away - my 2 cents anyway, not sure if other beginners feel the same

Will practice more myself and learn what I can, but I’m having to learn from other resources to understand further

Thanks
Alex


#30

Hello I am new to thimble and my wife got these as a gift for my kids and I. I am making the wifi bot now and my kit doesn’t have an arduino board. Was it supposed to come with one because I don’t have one in my kit. Can I order one somewhere?


#31

You should email support@thimble.io directly about this.


#32

To solve this problem, I turned the lower motor mount bolt around with the head on the inside (by the battery holder) and nut on the outside.