A little thrown together rover.

jscottb

Active member
I have worked a bit on a simple Pixaxe based rover. It has a Picaxe 20M2 as the core, an L9110 motor driver, 2 120:1 gear motors (TT) The PCB is one of my Pic proto boards. I have a servo (standard size), a Ping style ultrasonic sensor (though a SR-04 or 05 would work as well) There are two longarmed microswitches with a gate made from Hillman hobby type brackets from the hardware store. The platform was cutout on my little CNC and I have 3d printed motor brackets with some hot glue for extra support. The controller PCB is on a 3d printed mount I made for it. Next will be code cobbling time.
 

Attachments

jscottb

Active member
Thanks. Did a little code last night to test the parts. Bumpers, motor, and Ping all seem ok. Need to change out the servo for a quieter one. Also considering a lion-pack instead of the lipo.
 

jscottb

Active member
A little status update on my Picaxe bot(s). I remembered I had made this little chassis a few years back. It was made to be used for any uC you wanted but does have *rduino style mounting holes. This one has a Picaxe 8M2 on one of my Pic proto12F boards, 2x Feetech CR servos, and one HC-SR04 ultrasonic sensor. The rest is 3d printed (minus the 40mm O-rings) I will do some proper code for it later this week, but right now it's a lawn sprinkler :)

The little bot can be found here: https://www.thingiverse.com/thing:2765757
There is also a Github for the bot here: https://github.com/jscottb/bumpybot
My PCB's can be found here: https://github.com/jscottb/pcbs
 

Attachments

jscottb

Active member
Work has taken a lot of my free time but I did manage a little self-enjoyment coding tonight. :)

I have added a couple of LDRs for light interaction/mood-setting and a buzzer for sound. Hot-glue for that homey touch ;)
 

Attachments

jscottb

Active member
Thanks! I have been in a funk as of late and it's fun doing the stuff I used to like doing long ago.
 

stan74

Senior Member
Hi Erco. I got a $90 3d printer kit a few years ago and had loads of fun,,,and frustration :)
got this from ebay for a few quid. always wanted a tank track chassis. got to mount a platform and a hbridge and stuff...yawn
but after seeing my sons robot floor cleaner work, I think my projects need much work. I got my chassis for 7 quid

 

jscottb

Active member
Hi Erco. I got a $90 3d printer kit a few years ago and had loads of fun,,,and frustration :)
got this from ebay for a few quid. always wanted a tank track chassis. got to mount a platform and a hbridge and stuff...yawn
but after seeing my sons robot floor cleaner work, I think my projects need much work. I got my chassis for 7 quid

That's a nice little chassis! It should be a nice base to build on.
 

jscottb

Active member
Yeah, the L293 and the L298 are older and have that awful voltage drop with normal DC motors, but have that great redeeming quality of the ENA pins that can be used for speed control with just one PWM instead of two per channel. I use rechargeable AA's if I have room for them as well.

I put a 14M2 on a little chassis I have never found the right setup for, this past weekend. It has an L293D board and the 14M2 mounted on a micro naan board. Notice my trademark war paint and NP electro-caps for the motors ;) I had made my own 293 board for it, but after putting it one, decided the little Deek-Robot boards were a better fit. I have one pin left and may put a DDL OR connector board on it to run two IR prox modules off that free pin. I could use the serial pins, but that seems like cheating. Being able to speed control each motor with just one pin allows for a little chip like the 14M2 to be used for bot-in!
 

Attachments

stan74

Senior Member
I like your chassis jscottb sir. I have not tried a small wheel base/third wheel base yet....don't it fall over...seriously?

many hbridges for sale,good for us
I have one of these cos I built a cybot....silly me.
My stepper motor chassis
 

jscottb

Active member
I like your chassis jscottb sir. I have not tried a small wheel base/third wheel base yet....don't it fall over...seriously?

many hbridges for sale,good for us
I have one of these cos I built a cybot....silly me.
My stepper motor chassis
That chassis is stable and balanced ok, so not tippy.

That's a nice little bot! I like it. Boxy like a Volvo :) I drove one for years BTW. I have the TOF sensor, but not on a bot as of now.

I am trying to get inspired to build another big-ish bot again. The last one I did was a land nav that worked ok. It was a simple GPS bot that I did with an RPI (though it started out with a PCDuino 1) I also had RC on it via a Pro mini doing the RC mixing. I also had a Pro mini as the motor controller via i2c to the RPI. I2c issues among others were why I dumped the PCDunino. I did do another medium-sized bot that was a total failure, but a lot of learning. I learned a great deal on power distribution on a large distributed system (it had 9 uCs and one SBC) The I2c was a nightmare as was power. I did in the end get a lot sorted out and also figured that "yes, you can have too many wires" :) Next time will be a PCB based bus and several small internal power systems driven from a large main system.

What I have always wanted to build was a nice indoor task bot. Most of the past 7 years or so has been doing experiments and planning, but I'm still not sure of my final path. I have made the chassis I want for it. It's similar to the Parallax Stringray platform in shape and size. It's a 3d printed design I did I think three years past. It has 2 decks and room for a pony ;) I call it the "Platypus" I want a bot I don't have to rip apart to get to everything, but still, be able to keep it somewhat neat. It's 35cm long and 29.4cm wide. It has some aluminum channel on the bottom to mount and support the motors. Hot-glued on now for placement testing (hot glue is great for that). I have the same motors I had on my nav bot. They are nice motors that run fine on 7v or so (they are 12v rated), have good power, and are quiet-ish. I am still trying to get motivated though.

I do like that little stepper bot you have. What kind of motors?

Scott
 

Attachments

stan74

Senior Member
Hi Mr Scott, the stepper motors I used are ubiquitous https://www.ebay.co.uk/itm/Driver-Board-Stepper-Motors-28BYJ-48-LED-Wear-resistant-Set-5V-4-Phase-Geared/124271754944?hash=item1cef2c7ec0:g:eek:QUAAOSw~INe665Z
There are ways to pulse the pins,they come with a driver board. I used full wave. I used an every 2ms interrupt to change the on/offs for the 4 ports needed and same for other motor...another 4 ports. I dedicated uno portd for motors.
I can't post picaxe code cos I used a different basic...that does unos and nanos..sorry.
If you want to see the code here it is. Yeah.not picaxe but I got the v53L0X simplified working from posts to erco and had to translate picaxe basic..
not fun. Keep in touch as we're of thousands that like making "robots"....but what to get them to do??

;fullwave stepper V53L0X robot
#chip mega328p,16
#option Explicit

dir portc.0 out ;servo
dir portd.0 out:dir portd.1 out:dir portd.2 out:dir portd.3 out ;left motor
dir portd.4 out:dir portd.5 out:dir portd.6 out:dir portd.7 out ;right motor
dir portc.3 out
;set up V53L0X
#define HI2C_DATA PORTC.5 ;sda portc.4 for nano portc.5 for uno
#define HI2C_CLOCK PORTC.4 ;scl portc.5 for nano portc.4 for uno
#define HI2C_BAUD_RATE 400
HI2CMode Master
;
;v53l0x software restart
HI2CStart
HI2CSend(0x52)
HI2CSend(0x89)
HI2CSend(0x01)
HI2CStop
wait 200 ms
;
dim l_mot_pos,r_mot_pos as byte
dim l_mot_dir,r_mot_dir as byte
dim servopos as Word
dim servodir,distance_lo,distance_hi,mindist,last_turn as Byte
;
;interrupt variables
dim motors_event,motors_event_timer as byte
dim servo_event,servo_event_timer as byte
motors_event_timer=0:servo_event_timer=0
motors_event=2 ;every 2ms
servo_event=20 ;every 20ms
;------------
;
#define distance distance_hi*256 + distance_lo ;v53l0x distance
#define forward 1 ;|
#define reverse 255 ;|--motor direction
#define stop 0 ;|
#define servopin portc.0
#define wasleft 1
#define wasright 0
;
last_turn = random and 1 ;0 or 1
servopos=1500 ;1.5ms servo mid position
servodir=1 ;servo rotation direction
mindist=200 ;minimum distance before avoiding
l_mot_pos=1:r_mot_pos=1
l_mot_dir=forward:r_mot_dir=forward
;-----------
;set up interrupts
On Interrupt Timer0Match1 Call isr
Dim OCR0 AS byte alias OCR0A
Dim TCCR0 AS byte alias TCCR0B
WGM01 = 1
OCR0 = 62 ;every 1ms. 124 for 2ms
TCCR0 = 0x28
TCCR0 = TCCR0 or 0x03 ;1ms. 0x04 2ms

;-----------
do ;main program
;check for objects and avoid
getdistance ;any object too close?
if distance <> 20 then ;20 means out of range so skip distance test
;
;distance to obstacle test
if servopos > 1300 then ;not pointing right
if servopos < 1700 then ;not pointing left
mindist = 200 ;pointing forward min distance
end if
else
mindist = 250 ; left and right min distance
end if
;
if distance < mindist then ;object close
l_mot_dir=stop:r_mot_dir=stop ;stop motors
;
if servopos > 1700 then
turnright_until_clear ;object left
last_turn = wasright
else if servopos < 1300 then
turnleft_until_clear ;object right
last_turn = wasleft
else ;obstacle forward
l_mot_dir=reverse : r_mot_dir=reverse : wait 500 ms ;reverse 500ms
if last_turn = wasright then ;turn right again
servodir=1
turnright_until_clear
else ;turn left again
servodir=0
turnleft_until_clear
end if
end if
l_mot_dir=forward:r_mot_dir=forward ;go forward
end if
end if
;
;rotate servo left-right
if servodir = 1 then
servopos = servopos +80
if servopos = 2220 then
servodir = 0
end if
else
servopos = servopos - 80
if servopos = 780 then
servodir = 1
end if
end if
; pulseout servopin,servopos us
wait 30 ms 'to allow servo to move slower and not overheat and getdistance to work
loop
;end of main
;-------------------
sub isr
motors_event_timer = motors_event_timer + 1
if motors_event_timer=motors_event then
motors : motors_event_timer=0 ;every 2ms
end if
servo_event_timer = servo_event_timer + 1
if servo_event_timer=servo_event then
servo : servo_event_timer=0 ;every 20ms
end if
end sub
;--------------------
sub getdistance
HI2CStart ;Sys V53L0X Range Start
HI2CSend(0x52)
HI2CSend(0x00)
HI2CSend(0x01)
HI2CStop

HI2CStart ;read distance
HI2CSend(0x52)
HI2CSend(0x1e)
HI2CReStart
HI2CSend(0x53) ;set the read flag
HI2CReceive(distance_hi)
HI2CReceive(distance_lo, NACK) ;read one byte and conclude
HI2CStop
end sub
;-------------------
sub turnleft_until_clear
do
l_mot_dir=reverse:r_mot_dir=forward ;rotate anti clockwise
wait 20 ms
l_mot_dir=stop:r_mot_dir=stop
getdistance
loop until distance > mindist ;rotate left until clear
end sub
;-------------------
sub turnright_until_clear
do
l_mot_dir=forward:r_mot_dir=reverse ;rotate clockwise
wait 20 ms
l_mot_dir=stop:r_mot_dir=stop
getdistance
loop until distance > mindist ;rotate right until clear
end sub
;-------------------
sub motors
;left motor
if l_mot_dir=stop then
set portd.0 off:set portd.1 off:set portd.2 off:set portd.3 off
else if l_mot_dir=forward then
l_mot_pos++
if l_mot_pos=5 then
l_mot_pos=1
end if
else
l_mot_pos---
if l_mot_pos=0 then
l_mot_pos=4
end if
end if
;
select case l_mot_pos
case 4
set portd.0 on:set portd.1 on:set portd.2 off:set portd.3 off
case 3
set portd.0 off:set portd.1 on:set portd.2 on:set portd.3 off
case 2
set portd.0 off:set portd.1 off:set portd.2 on:set portd.3 on
case 1
set portd.0 on:set portd.1 off:set portd.2 off:set portd.3 on
end select
;
;right motor
if r_mot_dir=stop then
set portd.4 off:set portd.5 off:set portd.6 off:set portd.7 off
else if r_mot_dir=forward then
r_mot_pos++
if r_mot_pos=5 then
r_mot_pos=1
end if
else
r_mot_pos---
if r_mot_pos=0 then
r_mot_pos=4
end if
end if
;
select case r_mot_pos
case 4
set portd.4 on:set portd.5 off:set portd.6 off:set portd.7 on
case 3
set portd.4 off:set portd.5 off:set portd.6 on:set portd.7 on
case 2
set portd.4 off:set portd.5 on:set portd.6 on:set portd.7 off
case 1
set portd.4 on:set portd.5 on:set portd.6 off:set portd.7 off
end select

end sub
;-------------------
sub servo
pulseout servopin,servopos us
end sub
 

stan74

Senior Member
Mr Scott.anything other than avoiding things for robot ideas welcome. I wish I could do C+...then.... but I can use freebasic to program windows or a raspberry pi but raspberry pi is not 8bit controller though..first time you compile a program and it works is nice.
The robot idea is universal even if the code is different language.
 

erco

Senior Member
Nice chassis, Stan, I bought two from the same seller a while back! I don't like that massive L298 though. My fave H-bridge is the MX1508: tiny and cheap, truth table attached.

I have bought dozens of these off Ebay for under a dollar with free ship, but at the moment, I can't find any free ship. Has China Coronavirus ended my stream of electronics bargains? There's a war coming, one way or another.

 

Attachments

stan74

Senior Member
I like the inhibit pin. fraid I use hardware pwm if possible...and all timing features of the chip
Erco I got a project
I got the strobe variable 47 to 52 hz, and the solenoid valve to work.
I used irf520 mosfet which is a bad choice but works and I had some.
want to see the "code" for a variable frequency 1ms pulse running with a 50hz pwm that pulses 1 to 19 ms every 20ms
which is for the solenois valve.
I got the bits...now to see if it works...
If this code is useful...

#chip mega328p,16
#option explicit
#define valve portd.6
#define strobe portd.7
#define drop_size_pot portc.0
#define strobe_pot portc.1
dir valve out
dir strobe out
dir drop_size_pot in
dir strobe_pot in
dim valve_pot_val , mills_counter , strobe_pot_val as byte
;-------------------------------
;start 1ms interrupt isr
On Interrupt Timer0Match1 Call valve_isr
Dim OCR0 AS byte alias OCR0A
Dim TCCR0 AS byte alias TCCR0B
WGM01 = 1
OCR0 = 249 ;1ms
TCCR0 = 0x28
TCCR0 = TCCR0 or 0x03
'--------------
do
;read strobe pot
strobe_pot_val = readad (strobe_pot)
wait 17300 us
wait strobe_pot_val 10us
pulseout strobe,1 ms
;read valve pot
valve_pot_val = scale(readad (drop_size_pot),0,255,1,19)
loop
Sub valve_isr ;called every mS
mills_counter ++
if mills_counter = 20 then
mills_counter = 0
set valve on
else if mills_counter = valve_pot_val then
set valve off
end if
End Sub
strobepwmvalve.jpg
 

jscottb

Active member
Nice chassis, Stan, I bought two from the same seller a while back! I don't like that massive L298 though. My fave H-bridge is the MX1508: tiny and cheap, truth table attached.

I have bought dozens of these off Ebay for under a dollar with free ship, but at the moment, I can't find any free ship. Has China Coronavirus ended my stream of electronics bargains? There's a war coming, one way or another.

I use a MX1508 in a little 3d printed combat bot I did. They are nice.

I think a few things have happened even before the virus in China. The CCP cut or fully stopped subsidized shipping @ two years past. Then the Tariffs hit and it rose a little more and now the pandemic.

I do agree. As a student of history, a world war is inevitable. But will not get political here.

Let's make bots and not war! :)
 

stan74

Senior Member
jscottb-There has been no problem in uk buying cheap stuff from china since the pandemic. when look for something on ebay they say here are other things you may be interested in... and yes there's loads of stuff I'm interested in. put the credit card away or regret it the next day.
erco-the solenoid valve I used...but free postage- https://www.ebay.co.uk/itm/DC-12V-Mini-Electric-Solenoid-Valve-N-C-Normally-Closed-Gas-Air-Water-Flow-Valve/254604769430?hash=item3b47a07896:g:Q7sAAOSwUF1edIwG
These valves use the water/air pressure to keep the valve open or shut,the solenoid does little work...in most valves that is.
I first saw the strobe water effect in a film called "now you see me" when they stop the rain.
I am using an every 1ms interrupt that increases a counter each interrupt , when the counter gets to 20 itis reset and the valve is turned on.
A pot is read and the a to d is scaled from 0-255 to 1-19. when the interrupt counter = the pot value it turns off the valve.
this repeats every 20ms ie 50Hz...which is the mains ac frequency in the uk.
the idea of the valve is to change the water droplet size apparently.
I bought 100 ultrabright white leds but yet to wire up...
thinking 3 in series would need 10.8V and parallel loads of 3 in series and run off 12V.
the leds are pulsed for 1ms every 20ms or so....the strobe rate is variable over a few Hz, so are running at 5% power but needs much googleing.
I'll youtube and post if mine works.
 

stan74

Senior Member
I didn't want to distract from your thread erco. I want to thank the forum moderator for not blocking my posts.
I get ideas that seem tidy and want to share that's all. How to implement them is up to the user. Take care.
 
Top