Award
Congratulations thetechguru, for answering the question and has received an EZ-Credit award! Share what you have learned and create a tutorial to help others by clicking here.

2 Questions Regarding Ez-b V4 Startup

Assistance Requested

Help Steve G with their question and receive $10 of EZ-Credit to get more robots and parts from our store. The following information was provided about their previous efforts searching tutorials for a resolution.

Steve G claims to have checked these sources:
 
#1

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 EZ-Builder already running. I power up the EZ-B4 and it automatically connects to EZ-Builder 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 EZ-Builder 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. Smile

I have found a few conversations, tutorials and activities that may help with your question. Take a look at these links. I've sorted them by what I believe to be most relevant but that is not always the case as I'm still learning.


Also, consider reviewing the Learn section for informative lessons and activities. Check it out!


#2

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 EZ-Builder 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, EZ-Builder 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

#3

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"Winky

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

#4

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

#5

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

#6

@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. Grin

@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. Smile

Steve.

#7

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);

Code:


# 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 EZ-Builder 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 EZ-Builder, load your project and run the specified script.


You can use the shortcut in your PCs startup so when booted it will open EZ-Builder 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.

#8

@Rich.

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

#9

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

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.

#10

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.