Ultimate arm tank, raspberry pi and flick hat


#1

Hi all, I am trying to control the arm tank using flick hat and raspberry pi but I am having some problems. Anyone have ever tried using flick hat on makeblock products?


#2

Are you using python for megapi ?

if so, I assume having whatever input processed by the raspberry logic is independent of the megapi board and should be possible to set up and tune :slightly_smiling_face:


#3

yeah i am using the python for megapi… but i am having problem to code using python taking from examples in the github (https://github.com/Makeblock-official/PythonForMegaPi). i try to do the examples but nothing happen to my robot.


#4

well I don’t know if you have configured your raspberry to be ready to work. In the same github you linked, there is a “Prepare for Raspberry pi” chapter. If I remember correctly that did not do the trick for me. I went with this tutorial:
configuring-gpio-serial-port-raspbian-jessie-including-pi-3
I did all the modifications there, except the last chapter: “Swapping the Serial Ports”
After that I was able to run the example codes :grin:

But one more thing, make sure you edit those examples before running them, as you have to specify the device '/dev/serial0' (serial communication channel) for initializing the megapi:

from megapi import *
if _name_ == '_main_':
   bot = MegaPi()
   bot.start('/dev/serial0')
   try:
      # stuff the robot will do

#5

i try to do like the instruction from your sources but i got this:
https://drive.google.com/open?id=1qZ-Am2iOws8eGmBpmmWFnjTKMqsRKIT8

here is my coding, hope anyone can help me with this thing.
https://drive.google.com/open?id=116hCxkSA6EY2bO-_0lEHSP6gJ-0fAitn


#6

what version of firmware is on the megapi?
did you try the encoder function, without a callback? (encoderMotorRun)
is there enough power?

I remember having your problem but not how exactly I moved on :confused:


#7

the megapi version i used is from this link:


i used the Firmware_For_MegaPi_New then i upload it to megapi using arduino IDE but choosing the board arduino/genuino Mega or Mega 2560 since arduino dont have megapi as an board extension. When i upload the firmware i unplugged the usb cable, did that affect the board? Do i have to just leave the cable connected?


#8

Try this instead, it’s the ever updated version from the official site
firmware_for_megapi.ino

About the USB cable, for the firmware update, you need it of course. After the update it depends on what connection you use. See the link and the chapter “Wiring”:

  1. soldered direct connection
  2. RJ25 cable and header
  3. USB cable

I have tried 1. and 3. and they worked. But you have to initialize the megapi with the selected connection. (check for the available connections and their names on raspberry: ls -l /dev )


#9

how do you connect raspbeery pi and megapi using usb cable? in the link you give it connect usb using me orion not megapi…


#10

i try to run coding but i still stuck at:
init MegaPi
<megapi.mSerial instance at 0x76758918>

can anyone shed some light please, i try to search google and found nothing on this.


#11

you need B-type USB cable for downloading programs and communications

how did you connect to it so far at all then?


#12

i used the B-type USB cable for communication between raspberry pi and megapi but i stuck on this error:
init MegaPi
<megapi.mSerial instance at 0x76758918>
it just stop there nothing come out afterwards. Then, i dont know what else to do. would you please shed some light… haha


#13

if you’re using the USB cable to stay connected, then try initializing with device name: /dev/ttyUSB0
eg. bot.start('/dev/ttyUSB0')


#14

thank you rdhelli… i just found out something if you using USB cable as the connection you need to have another power source connected to the megapi like 7.4V lithium battery… only then it works… but now my main issues is to configure the flick hat and just found out theres no API for motor…


#15

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.