Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

How To Add More Digital And Analog Ports Tutorial

Started this post on how to add more digital and analog ports to your EZB without losing speed or spending over $70 for another EZB

EDIT 3-31 ITS $69 FOR EZB and to usa its $25.56 CHEAPEST rate without tracking
to other countries its a lot more.
BOARD COST for circuit is under $3

BUT in my post there is disadvantage and advantages of both ideas ,EZB and multiplexer circuit


Analog multiplexing is using only one ADC port and have more then 16 analog inputs and depending on analog ports needed will depend on how many digital ports are used to switch it

VERY simple circuit only one chip under $1
will post a schematic up in a day or 2 and part # of the chip

Its analog switch so it very fast ,not much coding is needed ,not like using 2 EZB and have to pass info back and forth using bluetooth or USB or wifi

Analog ports the EZB only has a few,and needed for analog sensors or other boards like battery monitor ,or current on digital there is more then twice as much

PART 2 will be digital multiplexing
PART 3 will be using I2C bus

AI Support Bot
Related Content
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
HERE IS THE CHIP and in a day or 2 can show you how to easy hook up to EZB ,right now in china
so i c an make the super simple circuit ,but all is needed is the chip ,.1 mfd bypass cap and thats it on perfboard
its CD4051
Here is one link on the price $.52
cd4051 analog multiplexer
and the circuit of the chip

User-inserted image

as you can see pin 3 goes in ADC port and 11,10,9 is digital ports ,dont need 3 digital ports unless you need 8 inputs

Another item about using a chip like this ,if a analog port on EZB is not protected from over voltage you lose $70 or more, on this chip only $.51
so you get the more speed,more ADC ports ,ultra low cost and protection of over voltage
@Robomaker, don't get me wrong, having the possibility to add more digital ports to EZB could be interresting in big robots and big projects. But an easy integration in ARC is mandatory for me. It should not be more compex to handle that using 2 EZB.

You say that the coding shouldn't be a problem "since it looks simple"... Can you post a quick example of scripting or simple coding? I am interrested in evaluating the level of difficulty.
If you were to add more ports to the EZ-B, you will sacrifice communication speed. I do not recommend adding a multiplexor to the EZ-B for large projects.

By the time you source the materials, solder the breadboard and write the code... Your time is much better spent building robots and buying a second EZ-B.:)
DJ FIRST looking to sell the boards about $6 or less,and the coding might be more if you use a second EZB,then you are loooking at a drop in speed using 2 boards,needs to use bluetooth on both boards

Plus at back and forth communication.

Cant see how you would lose speed since is digital then using EZB with bluetooth,thats where speed it lost.

Most likely code will be made by me or someone else

IT only uses one chip ,plus radio shack board,plus connectors or straight wire ,no other parts. :)
United Kingdom
Using a second EZ-B would need no extra code other than the board number in all controls and EZ-Script commands. All native controls in ARC would work regardless of port and board used. All EZ-Script commands would also work.

Not only would it be much simpler to use two boards, and tie that in with the costs of extra code (think of it as time writing scripts is time not doing something else, I value that time highly) it would be both easier and cheaper in the long run to run 2 EZ-Bs.

Your design will always have it's limitations as previously expressed. The GetPing EZ-Script command would not function correctly if the sensor is on two of these sub ports. Script commands on two or more scripts running simultaneously may have problems, which poses as a huge limitation on any of my projects as I have 4 or 5 scripts running at any one time, sometimes more.

All native controls would no longer be supported and would require scripts to operate, as a minimum 4 Set Digital controls to select the correct sub port so that the other controls would operate would be required. Running this with scripts running in the background also would pose a serious problem.

The same limitations would apply to an I2C based extender, which I had looked in to and decided against, however I2C would pose the simpler and less conflicting of the two methods. Native controls would not work correctly, if at all however the conflicts with scripts would be avoided.

Personally I would not wish to script around these limitations or script the extra code required to select the correct sub port. And this is the recommendation from someone who enjoys writing scripts. The extra code would be an educational guesstimated 5 times as much as that of using a second EZ-B.

Simple logic knowing both how the chips work and how ARC/EZ-Script work dictates that the above is correct and 100% justified in it's conclusion - building a practical circuit would have no benefit in finding the conclusion.

Not forgetting the issues DJ has mentioned also.

There are some applications where I can see the benefit of using this circuit however the limitations and extra work required greatly outweigh the benefits. To put it in plain and simple terms, it's a $60 saving in exchange for a lot of headaches.

This is for the benefit of those who are deciding on which method to use. This is not an argument against any design and as such is not open for debate. Users may use this post as they see fit and are free to disregard it should they wish to. All datasheets and documentation has been digested prior to this posting.
MAIN problem most overlook is the speed of the bluetooth ,compare to speed of digital chip witch is less the microseconds.

You see that first you need to send info to the second board and then to port you want to use and then receive the info back using bluetooth again.

NOW using a digital chip you dont have that problem ,but there may be limitations ,just like in USING 2 EZB'S ,havent tried it or anyone else tried it too

Like the getping WILL NEED TO TRY IT,might be a easy fix for it.

I guess best way is the testing of it.

BUT check the speed of the bluetooth communication and compare to digital.

ANOTHER item others dont look at is size of the EZB and extra current it needs.

Adding the board is just like adding another sensor or using the serial command to another board
I see mostly nobody really try it (like me)so its kinda hard to say it may or may not have problems.

Its not made for every sensor or digital add-ons ,but it does help.

ONCE i build it witch takes less the hour only a few pins to solder will test for different add-ons

PLUS there are same chips that uses 4 output with one in,and 8 out 1 in ,so it uses less control lines to control it.
United Kingdom
A (very) quick Example Project for testing the circuit.

Imagine the circuit built, two servos connected to sub ports 0 and 1 (or 1 and 2 depending on how you name them)

D0-D3 are the control ports. D4 is the passthrough.
Two servos, set to D4.
Two scripts, one which sets servo on sub port 0 to a low position randomly the other that sets the other servo to a high position randomly.

Run each at different times and you have no problems.
Run both together and there will be times when the low position servo hits a high position and vice versa. The control portions of each script fight each other for control of the digital ports. ARC does not know the servo positions for the two servos and believes both to be the same.

This is with only two devices. Imagine the confusion and problems with having 16 devices on one port.

A major problem if limits are set on one servo and another pushes it past those limits, possibly causing physical damage.

This is just one limitation I mentioned.

One does not need to build the circuit in order to know the outcome.

And again, this is for the benefit of those who are deciding on which method to use. This is not an argument against any design and as such is not open for debate. Users may use this post as they see fit and are free to disregard it should they wish to. All datasheets and documentation has been digested prior to this posting.

Please, build the circuit. Test the circuit thoroughly. The limitations mentioned will be there, I personally guarantee it.
Wow, will you two ever both just agree on a statement?
I have a large project with lots of things going on and a few constantly running scripts. I've ran my robot on both 2 boards and now 3. One of the boards is fully loaded with Digital and ADC ports filled. The other two are less then 1/4 filled. At first when I started using 3 boards I had an issue with one or two Bluetooth connections disconnecting. Also I had bad lag problems with all my scripts running variables and monitoring ADC ports. The internal Bluetooth on my older laptop running Win 7 couldn't handle the extra load and it was a bottleneck. Following DJ's advice I disabled the internal Bluetooth and started using a USB 3.0 Bluetooth Dongle in one of the laptops 2.0 USB ports. That solved my connection and lag problems using 3 boards.

Never had slowdown or connection problem with using just two boards connected to the laptop with the old internal Bluetooth set up. And I had a lot going on in ARC.

However last night I tried to use a different "2.0" USB Dongle in place of the 3.0 Dongle. I started having the same old issues till I put the 3.0 back in. Also had the same results on a different Laptop from the same era. So, there is a speed issue with Bluetooth and Dongles are all not created equal. I have a feeling it's the way the Dongle is made and how good it's antenna is.

With all that said it still seems that the better choice would be to get a second (or third) EZB Board and to avoid the many other pitfalls described using Robotmakers idea. To avoid the Bluetooth bottleneck one could convert EZB to Wifi or USB. Still Robotmakers board would be an interesting experiment to try. ;) Early on DJ himself suggested to me in another post to "get inventive" and try to come up with a way to multiplex an ADC port to make two connections to it. Someone suggested using a simple resistor. I'm not knowable enough to do this but (personality aside) I'm glad it's being discussed and tried. :)
Thanks DAVID,but kinda hard to tell if the EZB is faster then using a straight digital board

IT seems i qam always wrong with RICH ,but its not a problem

Testing the board is the best way.
ON multiplexing analog ports there are many ways to do it with out using resistors.

KINDA hard to read one vaule with 2 resistors sending the same data at the same time,how does it know witch resistor has the data without a switch

on multiplex chip it is like spdt switch,now you can use 4066 witch is a single switch .
United Kingdom
@robotmaker, I have not said you are wrong. Please re-read my posts.
YOU are right and i dont need to read it again,i understand all posts you did,so may be a bad choice of words.
YOU JUST disagree wih me try to understand that RICH

Just nobody did any tests on using the board so they cant say much about the design unless they build and test it.

i have about 20 ezb boards can very easy use for my projects instead of the digital multiplex circuit

BUt main item every board you use it raises the current much higher,but on using the CMOS chip current is super low.

PLUS like DJ its slower the EZB because of the commucation speed.
United Kingdom
Not at all. I have not disagreed with you either other than you saying it needs to be made before anyone knows if it will work.

What I have done is exposed the limitations on this design, explained them and made you and other members aware of them so that you and they can made an informed decision on whether or not to use the circuit or choose to use another EZ-B.

I have said that this circuit may be of benefit in some applications, I do not believe it to be a complete waste of time and effort. However the limitations must be totally understood so that the users are not left unsatisfied with the results or worse, end up physically damaging their projects due to those limitations.

For instance, I can see this circuit being useful to control the different coloured LEDs inside my robots brain, an action which would require at least 5 digital ports for the basic plan, more on my more advanced plans. However it would pose problematic if I wanted to use this circuit to control the pan/tilt bracket on my robots neck, to control his arms, to control the H-Bridge, to control the ping sensor or sweep servo.

As I have attempted to make perfectly clear, my posts have not been to discredit or dispute any design but are purely to inform the forum users of the limitations which would be present in this design.
THats what i meen by the limitations i am also saying the same about using 2 EZB boards it has limitations too.

You have 16 leds you need to control ?

On servo's i dont think it will work,on sonars i think it will work because its used many times to control 16 of them,

I think the way is was done is 16 outputs used to get echo ,or send ping that received or send the ping is using 8 digital ports.

SO on the getping function you use the digital port on EZB like you said there is problem with that
and on send signal use the digital port.

NOW i know others wont use 16 sonars ,maybe 8 ,but thats 16 lines ,so 8 on the multiplex circuit and 8 on the EZB.


AND total cost of ezb is not $60 but close to $75 or more depend on the country you live in

WOW re-edit on cost its $69 for ezb and to fla its $25.56 is the cheapest rate
United Kingdom
I cannot and will not explain any further when it is perfectly clear in previous posts.

Also check your logic and check your maths. 16 sonars, that's 16 x 2. 16 on the multiplexer and 16 on the EZ-B so as to avoid the limitations right? So it takes 4 control ports and 1 pass through port for the multiplexer for 16 devices. That's 5. Plus the 16 for the echo of the sonar, that's 21 ports used on a 20 port board.
Yes,but not saying to use 16 sonars ,and i guess you dont understand what i said aboout using half the ports on EZB and half on multiplex circuit.

I said nobody would use 16 sonars maybe 8 ,so only 3 address lines and 1 I/O and you save 4 ports
and if you use all 16 ports the other 8 ports can be used to drive relay's or leds or ?

0-7 I/O is address is 1,2 and 4
0-15 I/O the address is 1,2,4 and 8
THEN the getping function wont be a problem using only 8 ports idea.

I am trying to explain the advantage of using the multiplex design over the EZB to me over $100 is a lot for second EZB in my robot ,plus as DJ said that speed is much less on EZB because of communcation and then high current draw.

So other need to know the disadvanges of using a second EZB too.
United Kingdom
Perhaps I mis-inerprited;


I think the way is was done is 16 outputs used to get echo ,or send ping that received or send the ping is using 8 digital ports.

SO on the getping function you use the digital port on EZB like you said there is problem with that and on send signal use the digital port.


NOW i know others wont use 16 sonars ,maybe 8 ,but thats 16 lines ,so 8 on the multiplex circuit and 8 on the EZB.

Has that been edited by the way? It started at 16, dropped to 8, back to 16 and ended at 8...;)

Also, DJ said


If you were to add more ports to the EZ-B, you will sacrifice communication speed

That doesn't mean using multiple EZ-Bs, it means adding more ports to one EZ-B.

Please enlighten us on the disadvantages of using a second EZ-B, other than the cost.
OR i didnt explain it correctly and i meant 8 not 16
it takes 16 lines for 8 sonars ,8 pings and 8 echo, ping is the start pulse and echo is the receive in PWM
I guess i didnt recheck my post wanted to get back and have my dessert at the party FOR EASTER.

I thought he meant you lose communication speed using 2 EZB witch you do.

Way a processor is made is that is has memory ,plus digital circuit ,timers and then uart communication circuit and clock circuits AND MORE before it gets to the digital port.

With a digital multiplex circuit is straight communication ,no bluetooth or uart or clocks or memory or digital circuits.

I dont think many knows how a processor really works and the circuits inside,coding and using is easy.

JUST follow the path on the processor that is use to see how slow it is and compare the path with multiplex chip.