United Kingdom
Asked — Edited
Resolved Resolved by thetechguru!

2 Questions Regarding Ez-B V4 Startup

Hi everyone.

I have a couple of questions regarding the start up of my EZ-B v4 that I have installed in to my bot today, and hope someone may be able to help answer.

Q1.) Is there a way to have the EZ-B4 auto connect to my computer when the v4 starts up? E.g, the computer is already on and ARC already running. I power up the EZ-B4 and it automatically connects to ARC without having to manually "scan" and "connect". (Via client mode).

Reason: I hooked up a remote control power switch to my v4 (like a cars remote central locking relay) which works great, and to have the v4 auto connect to ARC and control my bot straight away I thought would be a nice touch.

Q2.) Is it possible to have a custom verbal message, either using speech synthesis script, pandorabots control or prerecorded MP3 file, to automatically say something like, "Hello. How are you today?" or "My systems are now online. Welcome." ect, after the default "I am now connected to your network" phrase when I power up the v4?

Reason: Just because I think it would be a cool feature.

Cheers, Steve. :)


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

#1  

If you set up your router to always give your EZ-B the same IP address, you won't need to scan, just connect, which ARC can do at start-up.

I am answering from my phone, so I'll need to look later if no one else verifies first, but I am pretty sure that connect is a script action, so you could set up a script that keeps trying to connect and sleeps for a while if it fails, theb tries again. Would also need to stop trying once successful and detect the disconnect to start trying again.

Answer to the second answer is yes. Either sayezb script or mp3 could be scripted to run on connect, so you start your ez-b, ARC running the connect script detects it, and executes your startup scriot.

If I am wrong and conect is not a scriptable command, then you could use auto-hotkey scripts to do something similar.

Alan

#2  

Q2 - Yes. There is a gear icon on the connect dialog box. Click it and you can enter a script. I did something like this... sleep(1000) say ezb(" welcome, please wait calibrations in process" code code code code say ezb("Calibrations complete, how may I assist you")

I am out of town and not on my computer so this is a very basic example and may not be completely correct. Where I have written "code" is where I essentially sent serial commands to my 3 hbridges. Hope this helps somewhat.

Q1- I would also like to know the answer to this and how it would work. I suspect it would be in the same init scripting area.

                                      Chris
#3  

Alan have you received your ezb4? Any update to router options?

#4  

I haven't received it yet. I am expecting Roli's to start shipping next week so it should be soon (I have a Roli and a dev kit coming in one order).

So, back on topic, I got curious about this and booted up the laptop.

You can check if you are connected using script function:

IsConnected( boardIndex ) Returns TRUE or FALSE if the specified EZ-B board index is connected Example: $status = IsConnected(0)

You can connect with ControlCommand using one of the Connect parameters (you can connect individual boards or all at once).

You can use WaitForChange for IsConnected to change to false, and then starts looping through ControlCommand connect with a sleep before trying again, and stops executing when IsConnected returns true.

Then you use the gear icon next to the connection that Chris described above to execute whatever script you want on startup of the robot (or just execute the commands in the same script that is detecting your connection and execute them when IsConnected changes from false to true).

So, yes, you can absolutely do both things you asked.

Alan

United Kingdom
#5  

@thetechguru.

Thanks for your reply. Very helpful. That's great to hear that I can do what I asked. I'm coming to the end of the build part of my bot, and will give the start up commands a try soon. I'm pretty new to using the EZ-B and still have a lot of learning to do, but hopefully I will be able to work out what I need to do to get the functions I would like my bot to have working. Thanks again. :D

@kamaroman68.

Thank you for your reply also. It's good to hear that someone else has done something similar to what I asked, and your post was helpful too. Thanks. :)

Steve.

United Kingdom
#6  

You will need a connection script (here's an old one for connecting all 5 EZ-Bs, it may use old syntax as it's an old script);


# Auto Connect/Reconnect Script
# Version: 1.0

:start
# Check if EZBs are connected
IF (IsConnected(0) = FALSE or IsConnected(1) = FALSE or IsConnected(2) = FALSE or IsConnected(3) = FALSE or IsConnected(4) = FALSE)
  # Visual output
  PRINT("Connection Error: Attempting Reconnection")
  # If any are not connected attempt to connect all
  ControlCommand("Connection", ConnectAll)
# End of if statement
ENDIF 
  # Return to the start
GOTO(start)

This must be an EZ-Script control not part of script manager. Name it "Auto Connect".

Now, use the shortcut creator in ARC to create a shortcut for the project. The creator will ask if you want to run a script on load, use the above "Auto Connect" script.

Now when you open the shortcut it will load ARC, load your project and run the specified script.

You can use the shortcut in your PCs startup so when booted it will open ARC and connect. If the EZ-B is in AP mode set the wifi to auto connect to the EZ-B WiFi. If client mode make sure you have a fixed IP.

You could go one step further. Set up EventGhost. Add a macro which pings the EZ-B IP. If it's "alive" have it run the shortcut. This will automate the entire process so all you need to do is hit the switch on the EZ-B.

United Kingdom
#7  

@Rich.

Thanks for the reply. Your instructions for the set up will come in very useful indeed. Much appreciated. ;)

United Kingdom
#8  

Only me. I'm just getting back in to the swing of things with my build after unexpectedly spending a few days in hospital. :(

Anyway, I have been having a good play around with my EZ-B today and pleased to say that I got the verbal start up script working just the way I wanted, so I just wanted to say thanks again to Alan and Chris.

But I am still having a little trouble with the auto connect. I am using Virgin media's superhub 2 router and I can't figure out how to give my EZ-B a fixed IP address. I will be the first to admit that I'm really not that good with networking, so any more help anyone can offer regarding this would be a great help.

Thanks, Steve.

United Kingdom
#9  

VM's superhubs are better put in Modem mode (I have one, not sure if it's a 1 or a 2 though). I have had quite a bit of trouble with mine in router mode (unfortunately it's in router mode now since my buffalo air station died on me last week)

On mine...

Log in to the router Go to Advanced Settings Scroll down to DHCP Click on DHCP reservations Scroll down and there is Add Reservation

You will need to know the MAC address of the EZ-B but this should be in the lease table below the reservations.

But, I'm not 100% sure if I have a 1 or a 2 (possibly a 1) so if the above doesn't match what you have then I don't know.

#10  

Little hard to find complete documentation on the Virgin Media Superhub 2 router, but when there is a will, there is a way.

Log onto your router. Go to Advanced Settings.

Then go to DHCP and DHCP Reservation.

Attached Devices: Shows a list of devices currently connected to your Network. You can click Refresh to update the list.

To add a connected device to the reservation table: Select the connected device you'd like to add from the 'Attached Devices' table. Enter a friendly name for the device you'd like to add. Enter the IP Address you'd like to reserve for this device. Click 'Add Reservation' to add it to the reservations list.

To add a device that isn't currently connected to the IP Lease Table: Enter a friendly name for the device you'd like to add. Enter the MAC address of the device you'd like to add. Enter the IP address you'd like to reserve for this device. Click 'Add Reservation' to add it to the reservations list.

To delete a device from the reservation table: Select the device you want to delete and tick the Delete checkbox. You can repeat this for any other devices you wish to delete. Click 'Apply'.

IP Lease Table: Shows the details of all DHCP reservations. Note: You cannot reserve an IP address that is already leased to another device.

User-inserted image

United Kingdom
#12  

@Rich and @Alan.

Many thanks for the information. That should help me a lot. I will give it a try a little later. 1 question. What is the difference between router and modem mode? I read the documentation for the hub but it made me sense to me. confused

Steve.

#13  

If you are getting a wireless signal, it is in router mode, and you are all good. Modem mode is when you want to use your own wireless (or wired) router and you just want the SuperHub to provide connectivity to your ISP.

Alan

United Kingdom
#14  

Ok, that makes a little more sense (I think). Anyway I'm currently trying to set this up but the EZ-B is not showing up in the attached devices, only my laptop and phone. The EZ-B is connected and refreshing the list is not helping. Hub is still in router mode and EZ-B is in client mode. Trying to find how to switch it in to modem mode as Rich suggested. Also, where do I find the MAC address for the EZ-B? Can't see it in the lease table.

United Kingdom
#15  

Router and modem mode differences...

Basically, the superhub is a combo router/modem. If you were with VM a while back you got the old surf board modem and a separate router, the superhub has both in one.

In modem mode you will need a separate router. Modem mode turns off the router part of the superhub. All it then does is become a modem.

You connect the superhub to the WAN port of the router and the router does everything from there. This basically means you can use any router and have a lot more options if you need them (like I do). I changed mine as the wireless on the superhub was dropping a lot, I needed port forwarding where I could point an external port, for instance 8001 to an internal port of something else, such as 80. I have a lot of devices which use port 80 but only one can have the real port 80.

I also found the superhub to be unstable. Having read a lot about DD-WRT firmware I opted to get a router which supported it.

Don't put your superhub in modem mode if you don't have a separate router too.

United Kingdom
#16  

@Rich.

Thanks for your reply. That cleared things up a little more. No I i don't have a separate router, so hub is staying in router mode as you said. Still having trouble finding the EZ-B in the reservation list. confused

#17  

I assume your phone is Android since you mentioned it can see the EZ-B. Download "fing" from the google play store. It will give you the MAC addresses of all devices on your network, then you can manually add it on the dhcp reservation page in the router.

(there is a way to do it in Windows too, but fing is super simple).

Alan

United Kingdom
#18  

Sorry no, it's an iPhone I have.

#19  

If you know the current IP address of the EZ-B, or connect your pc to it in AP mode so you know the addres will be 192.168.1.1

Then follow these steps:

  1. open cmd command prompt

  2. ping the IP address at least once

  3. type ARP -a

You will see the Mac that matches the ip

United Kingdom
#20  

Thanks Alan. I'll give it a try tomorrow. Only problem about AP mode is that I have a HP laptop and it won't connect that way as there are issues with HP's and EZ-B AP connections at the moment, so I can only connect with client mode.

#21  

Client is fine as long as you know or can find the EZ-B current IP address.

There are also probably network tools similar to Fing for iPhone, I just don't know of any to recommend.

Alan

United Kingdom
#22  

No problem. I'll have a look through the App Store and see what I can find. IP address won't be a problem as it shows up when I run a scan and connect EZ-B. I'll keep you posted on how I get on tomorrow.

United Kingdom
#23  

Hi. Just a quick update and a question for this topic.

I finally managed to sort out the IP/MAC address for my EZ-B on my VM router so thanks for everyone's input. I followed Rich's instructions and script and when the EZ-B is on and I open up my project shortcut, "it does exactly what it says on the tin" and auto connects every time. Good stuff and thanks to Rich.

Now the question I have is this. As I just mentioned, this works great and will come in handy, but it wasn't exactly what I was originally looking for. What I wanted was to be able to things the other way around.

E.g. The PC is on and my project is already loaded and running, EZ-B not powered up yet. What I would like to do is to power up my EZ-B (via IR remote control which I have set up) and have it auto connect to my already running ARC project.

Is there a way of doing this? confused

United Kingdom
#24  

Without constantly attempting connection in ARC, which would end up with it asking if you need help on connecting you will need to use another small piece of software...

EventGhost. Set up a macro to ping the IP of the EZ-B at regular intervals. On successful ping have it fire a script command (via telnet) to ARC which connects the EZ-B. Use the "On Connection" script to start any required scripts running.

It's not difficult to set up but you will need to install EventGhost and set up a python script for the telnet command and enable the ping addon.

If Python isn't your thing you could have it run the ARC project shortcut which would open ARC and run the desired On Load script (such as auto connect).

#25  

@Steve

I use the following script to do exactly what you looking for. With this method you don't get the failed connection dialog Rich was explaining. You probably want to adjust the sleep commands to your liking (longer the better) but other then that should be able to just copy and paste this into your script.

:start
$status = IsConnected(0)
If($status = FALSE)
ControlCommand("Connection", Connect0)
sleep (5000)
Goto (start)
EndIf
If($status = TRUE)
sleep (60000)
Goto (start)
EndIf